Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,6 @@ docs/docs/reference

# lock file
uv.lock

# PyCharm
.idea/
2 changes: 1 addition & 1 deletion src/exchange/moderators/summarizer.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ During your conversation with the user, you may be asked to summarize the conten
When asked to summarize, you should concisely summarize the conversation giving emphasis to newer content. Newer content will be towards the end of the conversation.
Preferentially keep user supplied content in the summary.

The summary *MUST* include filenames that were touched and/or modifed. If the updates occured more recently, keep the latest modifications made to the files in the summary. If the changes occured earlier in the chat, briefly summarize the changes and don't include the changes in the summary.
The summary *MUST* include filenames that were touched and/or modified. If the updates occurred more recently, keep the latest modifications made to the files in the summary. If the changes occurred earlier in the chat, briefly summarize the changes and don't include the changes in the summary.

There will likely be json formatted blocks referencing ToolUse and ToolResults. You can ignore ToolUse references, but keep the ToolResult outputs, summarizing as needed and with the same guidelines as above.
2 changes: 1 addition & 1 deletion src/exchange/moderators/truncate.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ def rewrite(self, exchange: Type["exchange.exchange.Exchange"]) -> None: # noqa
if exchange.messages[0].tool_result:
pop_checkpoint(exchange, exclude_last=1)

# Update the token count on the the first checkpoint to reflect the system prompt
# Update the token count on the first checkpoint to reflect the system prompt
exchange.checkpoints[0].token_count += self.system_prompt_token_count
2 changes: 1 addition & 1 deletion tests/providers/test_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ def test_anthropic_integration():
reply = provider.complete(model=model, system=system, messages=messages)

assert reply[0].content is not None
print("Completion content from Anthropics:", reply[0].content)
print("Completion content from Anthropic:", reply[0].content)
4 changes: 2 additions & 2 deletions tests/providers/test_bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ def test_message_to_bedrock_spec_tool_result(bedrock_provider):


def test_message_to_bedrock_spec_tool_result_text(bedrock_provider):
tool_result = ToolResult(tool_use_id="tool-1", output="Error occured", is_error=True)
tool_result = ToolResult(tool_use_id="tool-1", output="Error occurred", is_error=True)
message = Message(role="user", content=[tool_result])
expected = {
"role": "user",
"content": [
{
"toolResult": {
"toolUseId": "tool-1",
"content": [{"text": "Error occured"}],
"content": [{"text": "Error occurred"}],
"status": "error",
}
}
Expand Down