Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
06828ee
Initial Commit for Olama Connector
nmoeller Sep 12, 2025
02c4852
Merge remote-tracking branch 'origin/main' into nmoeller/olamaconnector
nmoeller Sep 12, 2025
beab7d4
Added Olama Sample
nmoeller Sep 12, 2025
80cf98d
Add Sample & Fixed Open Telemetry
nmoeller Sep 12, 2025
afc7190
Fixed Spelling from Olama to Ollama
nmoeller Sep 12, 2025
cbdb533
remove"opentelemetry-semantic-conventions-ai ~=0.4.13" since its hand…
nmoeller Sep 12, 2025
c1f2ee6
Merge branch 'main' into features/python_olama_connector
nmoeller Sep 14, 2025
3518527
Added Tool Calling
nmoeller Sep 15, 2025
545b52e
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Sep 15, 2025
9c93812
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Sep 17, 2025
460be3c
Finalizing test cases
nmoeller Sep 20, 2025
1c4115a
Merge branch 'main' into features/python_olama_connector
nmoeller Sep 20, 2025
279392d
Adjust samples to be more reliable
nmoeller Sep 20, 2025
efac8b7
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller Sep 20, 2025
0e62fd8
Update python/packages/ollama/agent_framework_ollama/_chat_client.py
nmoeller Sep 20, 2025
ea7f1d5
Update python/packages/ollama/pyproject.toml
nmoeller Sep 20, 2025
0abeec6
Update python/packages/ollama/tests/test_ollama_chat_client.py
nmoeller Sep 20, 2025
d2e2f1b
Update python/packages/ollama/agent_framework_ollama/_chat_client.py
nmoeller Sep 20, 2025
133fd12
Improved Docstrings & Sample
nmoeller Sep 21, 2025
22e7438
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller Sep 21, 2025
8a78094
Update python/packages/ollama/agent_framework_ollama/_chat_client.py
nmoeller Sep 23, 2025
f96f817
Integrate PR Feedback
nmoeller Sep 24, 2025
9a09b52
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller Sep 24, 2025
d28bea0
Revert setting, so it can be none
nmoeller Sep 24, 2025
1030b50
Validate Message formatting between AF and Ollama
nmoeller Sep 24, 2025
290d2f7
Catch Ollama Error and raise a ServiceResponse Error
nmoeller Sep 25, 2025
883e51a
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Sep 25, 2025
79933f8
Fix mypy error
nmoeller Sep 25, 2025
604b545
remove .vscode comma
nmoeller Sep 25, 2025
2e0da1e
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Oct 2, 2025
d180c2c
Add Reasoning support & adjust to new structure
nmoeller Oct 2, 2025
c09242b
Add Ollama Multimodality and Reasoning
nmoeller Oct 3, 2025
f0bc638
Add test cases for reasoning
nmoeller Oct 3, 2025
9d39405
Merge branch 'main' into features/python_olama_connector
nmoeller Oct 3, 2025
83ba556
Add Tests for Error Handling in Ollama Client
nmoeller Oct 3, 2025
9df622e
Update python/samples/getting_started/multimodal_input/ollama_chat_mu…
nmoeller Oct 3, 2025
3c697dc
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller Oct 3, 2025
ce819ef
Integrated Copilot Feedback
nmoeller Oct 3, 2025
637f2a8
Merge branch 'main' into features/python_olama_connector
nmoeller Oct 14, 2025
1eecd6d
Implement first PR Feedback
nmoeller Oct 14, 2025
14614c7
Adjust Readme files for examples
nmoeller Oct 14, 2025
e74dd4e
Adjust argument passing via additional chat options
nmoeller Oct 15, 2025
2409f47
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Nov 10, 2025
a77df42
Merge branch 'main' into features/python_olama_connector
nmoeller Nov 10, 2025
11b4d85
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Nov 22, 2025
87155b4
Implemented PR Feedback
nmoeller Nov 22, 2025
6a94aef
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Dec 11, 2025
760dba2
Removing Ollama Package from Core and moving samples
nmoeller Dec 11, 2025
790d997
Fix Link & Adding Samples to Main Sample Readme
nmoeller Dec 11, 2025
21cdb4d
Fixing Links in Readme
nmoeller Dec 11, 2025
455045e
Moved Multimodal and Chat Example
nmoeller Dec 11, 2025
f51a446
Fixed Link in ChatClient to Ollama
nmoeller Dec 12, 2025
a3ecf1a
Merge branch 'main' into features/python_olama_connector
nmoeller Dec 12, 2025
1032d53
Fix AgentFramework Links in Ollama Project
nmoeller Dec 12, 2025
a7f13b0
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller Dec 12, 2025
11caec0
Merge branch 'main' into features/python_olama_connector
nmoeller Dec 12, 2025
ae93cbc
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller Dec 12, 2025
5bad674
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller Dec 16, 2025
ba3be39
Fix observability breaking change
nmoeller Dec 16, 2025
5202fea
Merge branch 'main' into features/python_olama_connector
nmoeller Dec 16, 2025
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
29 changes: 29 additions & 0 deletions python/packages/core/agent_framework/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,15 @@ def text(self) -> str:
"""
return " ".join(content.text for content in self.contents if isinstance(content, TextContent))

@property
def reasoning(self) -> str:
"""Returns the reasoning content of the message.

Remarks:
This property concatenates the text of all TextReasoningContent objects in Contents.
"""
return " ".join(content.text for content in self.contents if isinstance(content, TextReasoningContent))


# region ChatResponse

Expand Down Expand Up @@ -2303,6 +2312,11 @@ def text(self) -> str:
"""Returns the concatenated text of all messages in the response."""
return ("\n".join(message.text for message in self.messages if isinstance(message, ChatMessage))).strip()

@property
def reasoning(self) -> str:
"""Returns the concatenated reasoning of all messages in the response."""
return ("\n".join(message.reasoning for message in self.messages if isinstance(message, ChatMessage))).strip()

def __str__(self) -> str:
return self.text

Expand Down Expand Up @@ -2438,6 +2452,11 @@ def text(self) -> str:
"""Returns the concatenated text of all contents in the update."""
return "".join(content.text for content in self.contents if isinstance(content, TextContent))

@property
def reasoning(self) -> str:
"""Returns the reasoning content of the message."""
return " ".join(content.text for content in self.contents if isinstance(content, TextReasoningContent))

def __str__(self) -> str:
return self.text

Expand Down Expand Up @@ -2560,6 +2579,11 @@ def text(self) -> str:
"""Get the concatenated text of all messages."""
return "".join(msg.text for msg in self.messages) if self.messages else ""

@property
def reasoning(self) -> str:
"""Get the concatenated reasoning of all messages."""
return " ".join(msg.reasoning for msg in self.messages) if self.messages else ""

@property
def user_input_requests(self) -> list[UserInputRequestContents]:
"""Get all BaseUserInputRequest messages from the response."""
Expand Down Expand Up @@ -2712,6 +2736,11 @@ def text(self) -> str:
else ""
)

@property
def reasoning(self) -> str:
"""Get the concatenated text of all TextReasoningContent objects in contents."""
return " ".join(content.text for content in self.contents if isinstance(content, TextReasoningContent))

@property
def user_input_requests(self) -> list[UserInputRequestContents]:
"""Get all BaseUserInputRequest messages from the response."""
Expand Down
28 changes: 28 additions & 0 deletions python/packages/core/agent_framework/ollama/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) Microsoft. All rights reserved.

import importlib
from typing import Any

PACKAGE_NAME = "agent_framework_ollama"
PACKAGE_EXTRA = "ollama"
_IMPORTS = [
"OllamaChatClient",
"OllamaSettings",
"__version__",
]


def __getattr__(name: str) -> Any:
if name in _IMPORTS:
try:
return getattr(importlib.import_module(PACKAGE_NAME), name)
except ModuleNotFoundError as exc:
raise ModuleNotFoundError(
f"The '{PACKAGE_EXTRA}' extra is not installed, "
f"please do `pip install agent-framework[{PACKAGE_EXTRA}]`"
) from exc
raise AttributeError(f"Module {PACKAGE_NAME} has no attribute {name}.")


def __dir__() -> list[str]:
return _IMPORTS
13 changes: 13 additions & 0 deletions python/packages/core/agent_framework/ollama/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) Microsoft. All rights reserved.

from agent_framework_ollama import (
OllamaChatClient,
OllamaSettings,
__version__,
)

__all__ = [
"OllamaChatClient",
"OllamaSettings",
"__version__",
]
21 changes: 21 additions & 0 deletions python/packages/ollama/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
9 changes: 9 additions & 0 deletions python/packages/ollama/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Get Started with Microsoft Agent Framework Ollama

Please install this package as the extra for `agent-framework`:

```bash
pip install agent-framework[ollama]
```

and see the [README](https://github.com/microsoft/agent-framework/tree/main/python/README.md) for more information.
16 changes: 16 additions & 0 deletions python/packages/ollama/agent_framework_ollama/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) Microsoft. All rights reserved.

import importlib.metadata

from ._chat_client import OllamaChatClient, OllamaSettings

try:
__version__ = importlib.metadata.version(__name__)
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0" # Fallback for development mode

__all__ = [
"OllamaChatClient",
"OllamaSettings",
"__version__",
]
Loading