Python: [BREAKING] update to v1.0.0 (#5062)

* updates to final deprecated pieces and versions

* fix mypy

* fix readme links
This commit is contained in:
Eduard van Valkenburg
2026-04-02 15:26:30 +00:00
committed by GitHub
parent 5f06b68535
commit 3446eb8d5d
171 changed files with 2580 additions and 2392 deletions
@@ -239,8 +239,8 @@ async def test_cmc(
mock_chat_completion_response: AsyncStream[OllamaChatResponse],
) -> None:
mock_chat.return_value = mock_chat_completion_response
chat_history.append(Message(text="hello world", role="system"))
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="system"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
result = await ollama_client.get_response(messages=chat_history)
@@ -261,8 +261,8 @@ async def test_cmc_response_format_dict(
prompt_eval_count=1,
created_at="2024-01-01T00:00:00Z",
)
chat_history.append(Message(text="hello world", role="system"))
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="system"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
result = await ollama_client.get_response(
@@ -283,7 +283,7 @@ async def test_cmc_reasoning(
mock_chat_completion_response_reasoning: AsyncStream[OllamaChatResponse],
) -> None:
mock_chat.return_value = mock_chat_completion_response_reasoning
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
result = await ollama_client.get_response(messages=chat_history)
@@ -300,7 +300,7 @@ async def test_cmc_chat_failure(
) -> None:
# Simulate a failure in the Ollama client
mock_chat.side_effect = Exception("Connection error")
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
@@ -319,8 +319,8 @@ async def test_cmc_streaming(
mock_streaming_chat_completion_response: AsyncStream[OllamaChatResponse],
) -> None:
mock_chat.return_value = mock_streaming_chat_completion_response
chat_history.append(Message(text="hello world", role="system"))
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="system"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
result = ollama_client.get_response(messages=chat_history, stream=True)
@@ -337,7 +337,7 @@ async def test_cmc_streaming_reasoning(
mock_streaming_chat_completion_response_reasoning: AsyncStream[OllamaChatResponse],
) -> None:
mock_chat.return_value = mock_streaming_chat_completion_response_reasoning
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
result = ollama_client.get_response(messages=chat_history, stream=True)
@@ -355,7 +355,7 @@ async def test_cmc_streaming_chat_failure(
) -> None:
# Simulate a failure in the Ollama client for streaming
mock_chat.side_effect = Exception("Streaming connection error")
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
@@ -380,7 +380,7 @@ async def test_cmc_streaming_with_tool_call(
mock_streaming_chat_completion_response,
]
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
result = ollama_client.get_response(messages=chat_history, stream=True, options={"tools": [hello_world]})
@@ -411,7 +411,7 @@ async def test_cmc_with_dict_tool_passthrough(
) -> None:
"""Test that dict-based tools are passed through to Ollama."""
mock_chat.return_value = mock_chat_completion_response
chat_history.append(Message(text="hello world", role="user"))
chat_history.append(Message(contents=["hello world"], role="user"))
ollama_client = OllamaChatClient()
await ollama_client.get_response(
@@ -500,7 +500,7 @@ async def test_cmc_with_invalid_content_type(
async def test_cmc_integration_with_tool_call(
chat_history: list[Message],
) -> None:
chat_history.append(Message(text="Call the hello world function and repeat what it says", role="user"))
chat_history.append(Message(contents=["Call the hello world function and repeat what it says"], role="user"))
ollama_client = OllamaChatClient()
result = await ollama_client.get_response(messages=chat_history, options={"tools": [hello_world]})
@@ -517,7 +517,7 @@ async def test_cmc_integration_with_tool_call(
async def test_cmc_integration_with_chat_completion(
chat_history: list[Message],
) -> None:
chat_history.append(Message(text="Say Hello World", role="user"))
chat_history.append(Message(contents=["Say Hello World"], role="user"))
ollama_client = OllamaChatClient()
result = await ollama_client.get_response(messages=chat_history)
@@ -531,7 +531,7 @@ async def test_cmc_integration_with_chat_completion(
async def test_cmc_streaming_integration_with_tool_call(
chat_history: list[Message],
) -> None:
chat_history.append(Message(text="Call the hello world function and repeat what it says", role="user"))
chat_history.append(Message(contents=["Call the hello world function and repeat what it says"], role="user"))
ollama_client = OllamaChatClient()
result: AsyncIterable[ChatResponseUpdate] = ollama_client.get_response(
@@ -558,7 +558,7 @@ async def test_cmc_streaming_integration_with_tool_call(
async def test_cmc_streaming_integration_with_chat_completion(
chat_history: list[Message],
) -> None:
chat_history.append(Message(text="Say Hello World", role="user"))
chat_history.append(Message(contents=["Say Hello World"], role="user"))
ollama_client = OllamaChatClient()
result: AsyncIterable[ChatResponseUpdate] = ollama_client.get_response(messages=chat_history, stream=True)