Skip to content

Commit

Permalink
Mock request from prompt hub (#5011)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdankostic committed May 24, 2023
1 parent ae9f384 commit b85bc44
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/agents/test_conversational_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ def test_init():

@pytest.mark.unit
def test_init_with_summary_memory():
prompt_node = PromptNode(default_prompt_template="this is a test")
# Test with summary memory
agent = ConversationalAgent(prompt_node, memory=ConversationSummaryMemory(prompt_node))
assert isinstance(agent.memory, ConversationSummaryMemory)
with patch("haystack.nodes.prompt.prompt_template.PromptTemplate._fetch_from_prompthub") as mock_prompthub:
mock_prompthub.side_effect = [("This is a test prompt. Use your knowledge to answer this question: {question}")]
prompt_node = PromptNode(default_prompt_template="this is a test")
# Test with summary memory
agent = ConversationalAgent(prompt_node, memory=ConversationSummaryMemory(prompt_node))
assert isinstance(agent.memory, ConversationSummaryMemory)


@pytest.mark.unit
Expand Down

0 comments on commit b85bc44

Please sign in to comment.