From aa05528db0affe94ce0c302b880d9a2045eca72b Mon Sep 17 00:00:00 2001 From: Yi Lu Date: Wed, 16 Aug 2023 12:24:31 -0700 Subject: [PATCH] Fix tests for should answer history (#123) --- .gitignore | 3 ++- pyproject.toml | 2 +- tests/agent/test_conversational_agent.py | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9e2e706..dd62999 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,5 @@ data_map* \[('_type', 'fake'), ('stop', None)] .chroma/ -test_results/ \ No newline at end of file +test_results/ +lancedb/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8b86199..94e56ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "autochain" -version = "0.0.4" +version = "0.0.5" description = "AutoChain: Build lightweight, extensible, and testable LLM Agents" # TODO: add URLs, homepage, documentation authors = [ diff --git a/tests/agent/test_conversational_agent.py b/tests/agent/test_conversational_agent.py index 979752b..624aedf 100644 --- a/tests/agent/test_conversational_agent.py +++ b/tests/agent/test_conversational_agent.py @@ -88,11 +88,15 @@ def test_should_answer_prompt(openai_should_answer_fixture): os.environ["OPENAI_API_KEY"] = "mock_api_key" agent = ConversationalAgent.from_llm_and_tools(llm=ChatOpenAI(), tools=[]) - inputs = {"history": "good user query"} + history = ChatMessageHistory() + history.save_message("good user query", MessageType.UserMessage) + inputs = {"history": history} response = agent.should_answer(**inputs) assert isinstance(response, AgentFinish) - inputs = {"history": "bad user query"} + history = ChatMessageHistory() + history.save_message("bad user query", MessageType.UserMessage) + inputs = {"history": history} agent = ConversationalAgent(llm=ChatOpenAI(), tools=[]) response = agent.should_answer(**inputs) assert response is None