https://github.com/premai-io/prem-utils
🛠️ Utils to manage connectors and common utilities across Prem Components.
https://github.com/premai-io/prem-utils
Last synced: about 1 year ago
JSON representation
🛠️ Utils to manage connectors and common utilities across Prem Components.
- Host: GitHub
- URL: https://github.com/premai-io/prem-utils
- Owner: premAI-io
- License: mit
- Created: 2023-12-19T11:18:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-11T09:35:18.000Z (about 2 years ago)
- Last Synced: 2024-05-11T10:00:32.244Z (about 2 years ago)
- Language: Python
- Homepage:
- Size: 280 KB
- Stars: 2
- Watchers: 8
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🛠️ Prem Utils
Utilities, and Connectors in order to interact with all Model Serving and Fine-tuning Providers.
## 🗄️ Connectors
| Name | Status |
| ----------- | ---------- |
| Anthropic | Active |
| OpenAI | Active |
| Perplexity | Active |
| Cohere | Active |
| DeepInfra | Deprecated |
| FireworksAI | Deprecated |
| OctoAI | Deprecated |
| Groq | Active |
| Lamini | Deprecated |
| Mistral | Active |
| OpenRouter | Active |
| Prem | Active |
| Replicate | Deprecated |
| Together | Deprecated |
## 🤙 Usage
```bash
pip install prem-utils
```
```python
import asyncio
from inspect import iscoroutine
from prem_utils.connectors import openai
connector = openai.OpenAIConnector(api_key="")
prompt = "Hello, how are you?"
response = connector.chat_completion(model="gpt-3.5-turbo", messages=[{"role": "user", "content": prompt}])
if iscoroutine(response):
response = asyncio.run(response)
message = response["choices"][0]["message"]["content"]
print(message)
```
## 📦 Contribute
### Install the necessary dependencies
```bash
virtualenv venv -p=3.11
source venv/bin/activate
pip install -r requirements.txt
```
### Test all or one connector
```bash
# will run all the connectors
python e2e.py
# only one connector
python e2e.py --name perplexity
```