Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def gen() -> ChatResponseGen:
content=response_txt,
role=r["message"].get("role", MessageRole.ASSISTANT),
additional_kwargs={
"tool_calls": list(set(all_tool_calls)),
"tool_calls": all_tool_calls,
"thinking": thinking_txt,
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dev = [

[project]
name = "llama-index-llms-ollama"
version = "0.7.3"
version = "0.7.4"
description = "llama-index llms ollama integration"
authors = [{name = "Your Name", email = "[email protected]"}]
requires-python = ">=3.9,<4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ def test_chat_with_tools() -> None:
assert isinstance(tool_result.raw_output, Song)


@pytest.mark.skipif(
client is None, reason="Ollama client is not available or test model is missing"
)
def test_stream_chat_with_tools() -> None:
"""Makes sure that stream chat with tools returns tool call message without any errors"""
llm = Ollama(model=test_model, context_window=8000)
response = llm.stream_chat_with_tools(
[tool], user_msg="Hello! Generate a random artist and song."
)

for r in response:
tool_calls = llm.get_tool_calls_from_response(r)
assert len(tool_calls) == 1
assert tool_calls[0].tool_name == tool.metadata.name

tool_result = tool(**tool_calls[0].tool_kwargs)
assert tool_result.raw_output is not None
assert isinstance(tool_result.raw_output, Song)


@pytest.mark.skipif(
client is None, reason="Ollama client is not available or test model is missing"
)
Expand Down
Loading