Files
semantic-kernel/python/pyproject.toml
T
Nico MöllerandNico Möller ca7a58ed28 Python: #6499 Mistral AI Chat Completion (#7049)
### 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.
-->

 1. Why is this changed required ?
To enable Mistral Models with Semantic Kernel, there was the issue #6499
in the Backlog to add a MistralAI Connector
2. What problem does it solve ?
It solves the problem, that semantic kernel is not yet integrated with
MistralAI
3. What scenario does it contribute to?
The scenario is to use different connector than HF,OpenAI or
AzureOpenAI. When User's want to use Mistral they can easliy integrate
it now
4. If it fixes an open issue, please link to the issue here.
#6499 

### Description

The changes made are designed by the open_ai connector, i tried to stay
as close as possible to the structure.
For the integration i installed the mistral python package in the
repository.

I added the following Classes :
- MistrealAIChatPromptExcecutionSettings --> Responsible to administrate
the Prompt Execution against MistralAI
- MistralAIChatCompletion --> Responsible to coordinate the Classes and
for Content parsing
- MistralAISettings --> Basic Settings to work with the MistralAIClient

**To test the changes with the tests please add MISTRALAI_API_KEY and
MISTRALAI_CHAT_MODEL_ID as Enviorment Variable**

From a design decision i moved the processing of Functions from
Connectors to the ChatCompletionClientBaseClass

What is integrated yet :

- [X] Integrate Mistral AI ChatCompletion Models without Streaming
- [X] Integrate Mistral AI Chat Completion Models with Streaming
- [X] Simple Integration Test to test Streaming and non Streaming
- [x] Extended Testing including Unit Testing & More Integration Tests

### 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 😄

---------

Co-authored-by: Nico Möller <[email protected]>
2024-07-04 12:39:49 +00:00

182 lines
5.3 KiB
TOML

[tool.poetry]
name = "semantic-kernel"
version = "1.1.2"
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}
# 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}
[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"
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"
# 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", "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"]
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"