-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python : Ollama Connector for Agent Framework #1104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eavanvalkenburg
merged 60 commits into
microsoft:main
from
nmoeller:features/python_olama_connector
Dec 16, 2025
Merged
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 02c4852
Merge remote-tracking branch 'origin/main' into nmoeller/olamaconnector
nmoeller beab7d4
Added Olama Sample
nmoeller 80cf98d
Add Sample & Fixed Open Telemetry
nmoeller afc7190
Fixed Spelling from Olama to Ollama
nmoeller cbdb533
remove"opentelemetry-semantic-conventions-ai ~=0.4.13" since its hand…
nmoeller c1f2ee6
Merge branch 'main' into features/python_olama_connector
nmoeller 3518527
Added Tool Calling
nmoeller 545b52e
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller 9c93812
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller 460be3c
Finalizing test cases
nmoeller 1c4115a
Merge branch 'main' into features/python_olama_connector
nmoeller 279392d
Adjust samples to be more reliable
nmoeller efac8b7
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller 0e62fd8
Update python/packages/ollama/agent_framework_ollama/_chat_client.py
nmoeller ea7f1d5
Update python/packages/ollama/pyproject.toml
nmoeller 0abeec6
Update python/packages/ollama/tests/test_ollama_chat_client.py
nmoeller d2e2f1b
Update python/packages/ollama/agent_framework_ollama/_chat_client.py
nmoeller 133fd12
Improved Docstrings & Sample
nmoeller 22e7438
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller 8a78094
Update python/packages/ollama/agent_framework_ollama/_chat_client.py
nmoeller f96f817
Integrate PR Feedback
nmoeller 9a09b52
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller d28bea0
Revert setting, so it can be none
nmoeller 1030b50
Validate Message formatting between AF and Ollama
nmoeller 290d2f7
Catch Ollama Error and raise a ServiceResponse Error
nmoeller 883e51a
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller 79933f8
Fix mypy error
nmoeller 604b545
remove .vscode comma
nmoeller 2e0da1e
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller d180c2c
Add Reasoning support & adjust to new structure
nmoeller c09242b
Add Ollama Multimodality and Reasoning
nmoeller f0bc638
Add test cases for reasoning
nmoeller 9d39405
Merge branch 'main' into features/python_olama_connector
nmoeller 83ba556
Add Tests for Error Handling in Ollama Client
nmoeller 9df622e
Update python/samples/getting_started/multimodal_input/ollama_chat_mu…
nmoeller 3c697dc
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller ce819ef
Integrated Copilot Feedback
nmoeller 637f2a8
Merge branch 'main' into features/python_olama_connector
nmoeller 1eecd6d
Implement first PR Feedback
nmoeller 14614c7
Adjust Readme files for examples
nmoeller e74dd4e
Adjust argument passing via additional chat options
nmoeller 2409f47
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller a77df42
Merge branch 'main' into features/python_olama_connector
nmoeller 11b4d85
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller 87155b4
Implemented PR Feedback
nmoeller 6a94aef
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller 760dba2
Removing Ollama Package from Core and moving samples
nmoeller 790d997
Fix Link & Adding Samples to Main Sample Readme
nmoeller 21cdb4d
Fixing Links in Readme
nmoeller 455045e
Moved Multimodal and Chat Example
nmoeller f51a446
Fixed Link in ChatClient to Ollama
nmoeller a3ecf1a
Merge branch 'main' into features/python_olama_connector
nmoeller 1032d53
Fix AgentFramework Links in Ollama Project
nmoeller a7f13b0
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller 11caec0
Merge branch 'main' into features/python_olama_connector
nmoeller ae93cbc
Merge branch 'features/python_olama_connector' of https://github.com/…
nmoeller 5bad674
Merge remote-tracking branch 'origin/main' into features/python_olama…
nmoeller ba3be39
Fix observability breaking change
nmoeller 5202fea
Merge branch 'main' into features/python_olama_connector
nmoeller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eavanvalkenburg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
nmoeller marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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}]`" | ||
nmoeller marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) from exc | ||
| raise AttributeError(f"Module {PACKAGE_NAME} has no attribute {name}.") | ||
|
|
||
|
|
||
| def __dir__() -> list[str]: | ||
| return _IMPORTS | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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__", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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__", | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.