Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade ai-exchange to version 0.8.3 and fix tests #34

Merged
merged 2 commits into from
Sep 3, 2024
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[project]
name = "goose-ai"
description = "a programming agent that runs on your machine"
version = "0.8.3"
version = "0.8.4"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"attrs>=23.2.0",
"rich>=13.7.1",
"ruamel-yaml>=0.18.6",
"ai-exchange>=0.8.2",
"ai-exchange>=0.8.3",
"click>=8.1.7",
"prompt-toolkit>=3.0.47",
]
Expand Down
6 changes: 3 additions & 3 deletions src/goose/utils/ask.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from exchange import Exchange, Message
from exchange import Exchange, Message, CheckpointData


def ask_an_ai(input: str, exchange: Exchange, prompt: str = "", no_history: bool = True) -> Message:
Expand Down Expand Up @@ -61,9 +61,9 @@ def clear_exchange(exchange: Exchange, clear_tools: bool = False) -> Exchange:

"""
if clear_tools:
new_exchange = exchange.replace(messages=[], checkpoints=[], tools=())
new_exchange = exchange.replace(messages=[], checkpoint_data=CheckpointData(), tools=())
else:
new_exchange = exchange.replace(messages=[], checkpoints=[])
new_exchange = exchange.replace(messages=[], checkpoint_data=CheckpointData())
return new_exchange


Expand Down
6 changes: 3 additions & 3 deletions tests/utils/test_ask.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from unittest.mock import MagicMock, patch

import pytest
from exchange import Exchange
from exchange import Exchange, CheckpointData
from goose.utils.ask import ask_an_ai, clear_exchange, replace_prompt


Expand Down Expand Up @@ -76,7 +76,7 @@ def test_clear_exchange_without_tools():
new_exchange = clear_exchange(exchange, clear_tools=False)

# Assert
exchange.replace.assert_called_once_with(messages=[], checkpoints=[])
exchange.replace.assert_called_once_with(messages=[], checkpoint_data=CheckpointData())
assert new_exchange == exchange.replace.return_value, "Should return the modified exchange"


Expand All @@ -89,7 +89,7 @@ def test_clear_exchange_with_tools():
new_exchange = clear_exchange(exchange, clear_tools=True)

# Assert
exchange.replace.assert_called_once_with(messages=[], checkpoints=[], tools=())
exchange.replace.assert_called_once_with(messages=[], checkpoint_data=CheckpointData(), tools=())
assert new_exchange == exchange.replace.return_value, "Should return the modified exchange with tools cleared"


Expand Down