You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple, unified interface to multiple Generative AI providers.
6
7
7
8
`aisuite` makes it easy for developers to use multiple LLM through a standardized interface. Using an interface similar to OpenAI's, `aisuite` makes it easy to interact with the most popular LLMs and compare the results. It is a thin wrapper around python client libraries, and allows creators to seamlessly swap out and test responses from different LLM providers without changing their code. Today, the library is primarily focussed on chat completions. We will expand it cover more use cases in near future.
8
9
9
10
Currently supported providers are -
10
-
OpenAI, Anthropic, Azure, Google, AWS, Groq, Mistral, HuggingFace and Ollama.
To maximize stability, `aisuite` uses either the HTTP endpoint or the SDK for making calls to the provider.
12
13
13
14
## Installation
@@ -21,11 +22,13 @@ pip install aisuite
21
22
```
22
23
23
24
This installs aisuite along with anthropic's library.
25
+
24
26
```shell
25
27
pip install 'aisuite[anthropic]'
26
28
```
27
29
28
30
This installs all the provider-specific libraries
31
+
29
32
```shell
30
33
pip install 'aisuite[all]'
31
34
```
@@ -41,12 +44,14 @@ You can use tools like [`python-dotenv`](https://pypi.org/project/python-dotenv/
41
44
Here is a short example of using `aisuite` to generate chat completion responses from gpt-4o and claude-3-5-sonnet.
42
45
43
46
Set the API keys.
47
+
44
48
```shell
45
49
export OPENAI_API_KEY="your-openai-api-key"
46
50
export ANTHROPIC_API_KEY="your-anthropic-api-key"
47
51
```
48
52
49
53
Use the python client.
54
+
50
55
```python
51
56
import aisuite as ai
52
57
client = ai.Client()
@@ -67,6 +72,7 @@ for model in models:
67
72
print(response.choices[0].message.content)
68
73
69
74
```
75
+
70
76
Note that the model name in the create() call uses the format - `<provider>:<model-name>`.
71
77
`aisuite` will call the appropriate provider with the right parameters based on the provider value.
72
78
For a list of provider values, you can look at the directory - `aisuite/providers/`. The list of supported providers are of the format - `<provider>_provider.py` in that directory. We welcome providers adding support to this library by adding an implementation file in this directory. Please see section below for how to contribute.
@@ -79,9 +85,10 @@ aisuite is released under the MIT License. You are free to use, modify, and dist
79
85
80
86
## Contributing
81
87
82
-
If you would like to contribute, please read our [Contributing Guide](CONTRIBUTING.md) and join our [Discord](https://discord.gg/T6Nvn8ExSb) server!
88
+
If you would like to contribute, please read our [Contributing Guide](https://github.com/andrewyng/aisuite/blob/main/CONTRIBUTING.md) and join our [Discord](https://discord.gg/T6Nvn8ExSb) server!
83
89
84
90
## Adding support for a provider
91
+
85
92
We have made easy for a provider or volunteer to add support for a new platform.
86
93
87
94
### Naming Convention for Provider Modules
@@ -91,20 +98,24 @@ We follow a convention-based approach for loading providers, which relies on str
91
98
- The provider's module file must be named in the format `<provider>_provider.py`.
92
99
- The class inside this module must follow the format: the provider name with the first letter capitalized, followed by the suffix `Provider`.
"Nebius AI Studio API key is missing. Please provide it in the config or set the NEBIUS_API_KEY environment variable. You can get your API key at https://studio.nebius.ai/settings/api-keys"
20
+
)
21
+
22
+
config["base_url"] =BASE_URL
23
+
# Pass the entire config to the OpenAI client constructor
0 commit comments