Skip to content

Commit

Permalink
Fix tests for should answer history (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyiilluu committed Aug 16, 2023
1 parent c26912a commit aa05528
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,5 @@ data_map*
\[('_type', 'fake'), ('stop', None)]

.chroma/
test_results/
test_results/
lancedb/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
8 changes: 6 additions & 2 deletions tests/agent/test_conversational_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa05528

Please sign in to comment.