Name | delos-llmax JSON |
Version |
1.5.2
JSON |
| download |
home_page | None |
Summary | Interface to handle multiple LLMs and AI tools. |
upload_time | 2025-08-06 08:27:52 |
maintainer | None |
docs_url | None |
author | Delos Intelligence |
requires_python | <4.0,>=3.8.1 |
license | None |
keywords |
ai
llm
generative
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# llmax
Python package to manage most external and internal LLM APIs fluently.
# Installation
To install, run the following command:
```bash
python3 -m pip install delos-llmax
```
# How to use
You first have to define a list of `Deployment` as such, where you need to specify the endpoints, key and deployment_name. Then create the client:
```python
from llmax.clients import MultiAIClient
from llmax.models import Deployment, Model
deployments: dict[Model, Deployment] = {
"gpt-4o": Deployment(
model="gpt-4o",
provider="azure",
deployment_name="gpt-4o-2024-05-13",
api_key=os.getenv("LLMAX_AZURE_OPENAI_SWEDENCENTRAL_KEY", ""),
endpoint=os.getenv("LLMAX_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT", ""),
),
"whisper-1": Deployment(
model="whisper-1",
provider="azure",
deployment_name="whisper-1",
api_key=os.getenv("LLMAX_AZURE_OPENAI_SWEDENCENTRAL_KEY", ""),
endpoint=os.getenv("LLMAX_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT", ""),
api_version="2024-02-01",
),
}
client = MultiAIClient(
deployments=deployments,
)
```
Then you should define your input (that can be a text, image or audio, following the openai documentation for instance).
```python
messages = [
{"role": "user", "content": "Raconte moi une blague."},
]
```
And finally get the response:
```python
response = client.invoke_to_str(messages, model)
print(response)
```
# Specificities
When creating the client, you can also specify two functions, *increment_usage* and *get_usage*.
The first one is **Callable[[float, Model], bool]** while the second is **Callable[[], float]**.
*increment_usage* is a function that is called after a call of the llm. The float is the price and Model, the model used. It can therefore be used to update your database. *get_usage* returns whether a condition is met. For instance, it can be a function that calls your database and returns whether the user is still active.
Raw data
{
"_id": null,
"home_page": null,
"name": "delos-llmax",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8.1",
"maintainer_email": null,
"keywords": "AI, LLM, generative",
"author": "Delos Intelligence",
"author_email": "maximiliendedinechin@delosintelligence.fr",
"download_url": "https://files.pythonhosted.org/packages/d1/4f/baeadf5f4227424f9b7f5835f45b178cb286d54aed51de9df31f8d5798c4/delos_llmax-1.5.2.tar.gz",
"platform": null,
"description": "# llmax\n\nPython package to manage most external and internal LLM APIs fluently.\n\n\n# Installation\n\nTo install, run the following command:\n\n```bash\npython3 -m pip install delos-llmax\n```\n\n# How to use\n\nYou first have to define a list of `Deployment` as such, where you need to specify the endpoints, key and deployment_name. Then create the client:\n\n```python\nfrom llmax.clients import MultiAIClient\nfrom llmax.models import Deployment, Model\n\ndeployments: dict[Model, Deployment] = {\n \"gpt-4o\": Deployment(\n model=\"gpt-4o\",\n provider=\"azure\",\n deployment_name=\"gpt-4o-2024-05-13\",\n api_key=os.getenv(\"LLMAX_AZURE_OPENAI_SWEDENCENTRAL_KEY\", \"\"),\n endpoint=os.getenv(\"LLMAX_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT\", \"\"),\n ),\n \"whisper-1\": Deployment(\n model=\"whisper-1\",\n provider=\"azure\",\n deployment_name=\"whisper-1\",\n api_key=os.getenv(\"LLMAX_AZURE_OPENAI_SWEDENCENTRAL_KEY\", \"\"),\n endpoint=os.getenv(\"LLMAX_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT\", \"\"),\n api_version=\"2024-02-01\",\n ),\n }\n\nclient = MultiAIClient(\n deployments=deployments,\n )\n```\n\nThen you should define your input (that can be a text, image or audio, following the openai documentation for instance).\n\n```python\nmessages = [\n {\"role\": \"user\", \"content\": \"Raconte moi une blague.\"},\n ]\n```\n\nAnd finally get the response:\n\n```python\nresponse = client.invoke_to_str(messages, model)\nprint(response)\n```\n\n# Specificities\n\nWhen creating the client, you can also specify two functions, *increment_usage* and *get_usage*.\nThe first one is **Callable[[float, Model], bool]** while the second is **Callable[[], float]**.\n*increment_usage* is a function that is called after a call of the llm. The float is the price and Model, the model used. It can therefore be used to update your database. *get_usage* returns whether a condition is met. For instance, it can be a function that calls your database and returns whether the user is still active.\n",
"bugtrack_url": null,
"license": null,
"summary": "Interface to handle multiple LLMs and AI tools.",
"version": "1.5.2",
"project_urls": null,
"split_keywords": [
"ai",
" llm",
" generative"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0839186f2a609c0e2373c763efde0a1cecd4ca02d3aed0daf5a1faf1ae2437b3",
"md5": "a123ca4fab26bb1865f890b9db6b76d1",
"sha256": "b951c2e0d8345edacb86ced93f82b8f05c8972d42138516b9651c99b8a6a263f"
},
"downloads": -1,
"filename": "delos_llmax-1.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a123ca4fab26bb1865f890b9db6b76d1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8.1",
"size": 31112,
"upload_time": "2025-08-06T08:27:51",
"upload_time_iso_8601": "2025-08-06T08:27:51.413035Z",
"url": "https://files.pythonhosted.org/packages/08/39/186f2a609c0e2373c763efde0a1cecd4ca02d3aed0daf5a1faf1ae2437b3/delos_llmax-1.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d14fbaeadf5f4227424f9b7f5835f45b178cb286d54aed51de9df31f8d5798c4",
"md5": "2ca1bccffe2c14c1c35b10a31f1bc7e5",
"sha256": "df8c41b13252f5a7c878c4037d6f73b38d324f7bac26aad4cd0cb56cd850beba"
},
"downloads": -1,
"filename": "delos_llmax-1.5.2.tar.gz",
"has_sig": false,
"md5_digest": "2ca1bccffe2c14c1c35b10a31f1bc7e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8.1",
"size": 22104,
"upload_time": "2025-08-06T08:27:52",
"upload_time_iso_8601": "2025-08-06T08:27:52.857488Z",
"url": "https://files.pythonhosted.org/packages/d1/4f/baeadf5f4227424f9b7f5835f45b178cb286d54aed51de9df31f8d5798c4/delos_llmax-1.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-06 08:27:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "delos-llmax"
}