Skip to content

Commit

Permalink
chore: update stream auto tool_choice test
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelint committed Jul 23, 2024
1 parent 83b8277 commit e6c8782
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/test_functional/test_function_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ def magic_number_tool(input: int) -> int:
[magic_number_tool], tool_choice="magic_number_tool"
)

stream = llm_with_tool.stream("What is the magic mumber of 2?")
stream = llm_with_tool.stream(
[
HumanMessage(content="What is the magic mumber of 2?"),
]
)

tool_call_chunks = []
for chunk in stream:
Expand All @@ -99,6 +103,12 @@ def magic_number_tool(input: int) -> int:
assert len(tool_call_chunks) > 0
assert tool_call_chunks[0]["name"] == "magic_number_tool"

@pytest.mark.skip(
reason="""\
Stream + auto tool choice not supported yet. \
https://github.com/abetlen/llama-cpp-python/discussions/1615\
"""
)
def test_auto_function_calling(self, instance: LlamaChatModel):
@tool
def magic_number_tool(input: int) -> int:
Expand All @@ -109,9 +119,6 @@ def magic_number_tool(input: int) -> int:

stream = llm_with_tool.stream(
[
SystemMessage(
content="The assistant calls functions with appropriate input when necessary."
),
HumanMessage(content="What is the magic mumber of 2?"),
]
)
Expand Down

0 comments on commit e6c8782

Please sign in to comment.