Files
semantic-kernel/python/pyproject.toml
T
Tao Chen 79207ffbbc Python: Migrate to Ollama Python SDK (#7165)
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Currently, the Ollama AI connector uses `aiohttp` sessions to interface
with the local Ollama LLM service. However, we have made the decision to
transition to the official Ollama Python SDK.

Related to: https://github.com/microsoft/semantic-kernel/issues/6841,
https://github.com/microsoft/semantic-kernel/issues/7134

Test coverage report:

![image](https://github.com/microsoft/semantic-kernel/assets/12570346/8d414f71-fc1b-4870-b038-0f7d2985b985)

MyPy warnings: all cleared
### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
2024-07-16 22:38:21 +00:00

189 lines
5.5 KiB
TOML

[tool.poetry]
name = "semantic-kernel"
version = "1.2.0"
description = "Semantic Kernel Python SDK"
authors = ["Microsoft <[email protected]>"]
readme = "pip/README.md"
packages = [{include = "semantic_kernel"}]
[tool.poetry.dependencies]
python = "^3.10,<3.13"
# main dependencies
aiohttp = "^3.8"
pydantic = "^2"
pydantic-settings = "^2"
defusedxml = "^0.7.1"
# embeddings
numpy = [
{ version = ">=1.25", python = "<3.12" },
{ version = ">=1.26", python = ">=3.12" },
]
# openai connector
openai = ">=1.0"
# openapi and swagger
openapi_core = ">=0.18,<0.20"
prance = "^23.6.21.0"
# templating
pybars4 = "^0.9.13"
jinja2 = "^3.1.3"
nest-asyncio = "^1.6.0"
### Optional dependencies
# azure
azure-ai-inference = {version = "^1.0.0b1", allow-prereleases = true, optional = true}
azure-search-documents = {version = "11.6.0b4", allow-prereleases = true, optional = true}
azure-core = { version = "^1.28.0", optional = true}
azure-identity = { version = "^1.13.0", optional = true}
azure-cosmos = { version = "^4.7.0", optional = true}
# chroma
chromadb = { version = ">=0.4.13,<0.6.0", optional = true}
# hugging face
transformers = { version = "^4.28.1", extras=["torch"], optional = true}
sentence-transformers = { version = "^2.2.2", optional = true}
# mongo
motor = { version = "^3.3.2", optional = true }
# notebooks
ipykernel = { version = "^6.21.1", optional = true}
# milvus
pymilvus = { version = ">=2.3,<2.4.4", optional = true}
milvus = { version = ">=2.3,<2.3.8", markers = 'sys_platform != "win32"', optional = true}
# mistralai
mistralai = { version = "^0.4.1", optional = true}
# ollama
ollama = { version = "^0.2.1", optional = true}
# pinecone
pinecone-client = { version = ">=3.0.0", optional = true}
# postgres
psycopg = { version="^3.1.9", extras=["binary","pool"], optional = true}
# qdrant
qdrant-client = { version = '^1.9', optional = true}
# redis
redis = { version = "^4.6.0", optional = true}
# usearch
usearch = { version = "^2.9", optional = true}
pyarrow = { version = ">=12.0.1,<17.0.0", optional = true}
weaviate-client = { version = ">=3.18,<5.0", optional = true}
ruff = "0.5.1"
[tool.poetry.group.dev.dependencies]
pre-commit = ">=3.7.1"
ruff = ">=0.4.5"
ipykernel = "^6.29.4"
nbconvert = "^7.16.4"
pytest = "^8.2.1"
pytest-asyncio = "^0.23.7"
snoop = "^0.4.3"
pytest-cov = ">=5.0.0"
mypy = ">=1.10.0"
types-PyYAML = "^6.0.12.20240311"
[tool.poetry.group.unit-tests]
optional = true
[tool.poetry.group.unit-tests.dependencies]
azure-ai-inference = {version = "^1.0.0b1", allow-prereleases = true}
azure-search-documents = {version = "11.6.0b4", allow-prereleases = true}
azure-core = "^1.28.0"
azure-cosmos = "^4.7.0"
mistralai = "^0.4.1"
ollama = "^0.2.1"
transformers = { version = "^4.28.1", extras=["torch"]}
sentence-transformers = "^2.2.2"
[tool.poetry.group.tests]
optional = true
[tool.poetry.group.tests.dependencies]
# azure
azure-ai-inference = {version = "^1.0.0b1", allow-prereleases = true}
azure-search-documents = {version = "11.6.0b4", allow-prereleases = true}
azure-core = "^1.28.0"
azure-identity = "^1.13.0"
azure-cosmos = "^4.7.0"
msgraph-sdk = "^1.2.0"
# chroma
chromadb = ">=0.4.13,<0.6.0"
# hugging face
transformers = { version = "^4.28.1", extras=["torch"]}
sentence-transformers = "^2.2.2"
# milvus
pymilvus = ">=2.3,<2.4.4"
milvus = { version = ">=2.3,<2.3.8", markers = 'sys_platform != "win32"'}
# mistralai
mistralai = "^0.4.1"
# ollama
ollama = "^0.2.1"
# mongodb
motor = "^3.3.2"
# pinecone
pinecone-client = ">=3.0.0"
# postgres
psycopg = { version="^3.1.9", extras=["binary","pool"]}
# qdrant
qdrant-client = '^1.9'
# redis
redis = "^4.6.0"
# usearch
usearch = "^2.9"
pyarrow = ">=12.0.1,<17.0.0"
# weaviate
weaviate-client = ">=3.18,<5.0"
# Extras are exposed to pip, this allows a user to easily add the right dependencies to their environment
[tool.poetry.extras]
all = ["transformers", "sentence-transformers", "qdrant-client", "chromadb", "pymilvus", "milvus", "mistralai", "ollama", "weaviate-client", "pinecone-client", "psycopg", "redis", "azure-ai-inference", "azure-search-documents", "azure-core", "azure-identity", "azure-cosmos", "usearch", "pyarrow", "ipykernel", "motor"]
azure = ["azure-ai-inference", "azure-search-documents", "azure-core", "azure-identity", "azure-cosmos", "msgraph-sdk"]
chromadb = ["chromadb"]
hugging_face = ["transformers", "sentence-transformers"]
milvus = ["pymilvus", "milvus"]
mistralai = ["mistralai"]
ollama = ["ollama"]
mongo = ["motor"]
notebooks = ["ipykernel"]
pinecone = ["pinecone-client"]
postgres = ["psycopg"]
qdrant = ["qdrant-client"]
redis = ["redis"]
usearch = ["usearch", "pyarrow"]
weaviate = ["weaviate-client"]
[tool.ruff]
line-length = 120
target-version = "py310"
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
[tool.ruff.lint]
preview = true
select = ["D", "E", "F", "I", "CPY", "ISC", "INP", "RSE102", "RET", "SIM", "TD", "FIX", "ERA001", "RUF"]
ignore = ["D100", "D101", "D104", "TD003", "FIX002"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
# Ignore all directories named `tests` and `samples`.
"tests/**" = ["D", "INP", "TD", "ERA001", "RUF"]
"samples/**" = ["D", "INP", "ERA001", "RUF"]
# Ignore all files that end in `_test.py`.
"*_test.py" = ["D"]
"*.ipynb" = ["CPY", "E501"]
[tool.ruff.lint.flake8-copyright]
notice-rgx = "^# Copyright \\(c\\) Microsoft\\. All rights reserved\\."
min-file-size = 1
[tool.bandit]
targets = ["python/semantic_kernel"]
exclude_dirs = ["python/tests"]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"