A Python package for working with GPTRouter APIs
Project description
GPTRouter Python Client
This is a Python client for the GPTRouter APIs.
Installation
Use the package manager pip to install gpt-router.
pip install gpt-router
Usage
from gpt_router.client import GPTRouterClient
from gpt_router.models import ModelGenerationRequest, GenerationParams
from gpt_router.enums import ModelsEnum, ProvidersEnum
client = GPTRouter(base_url='your_base_url', api_key='your_api_key')
messages = [
{"role": "user", "content": "Write me a short poem"},
]
prompt_params = GenerationParams(messages=messages)
claude2_request = ModelGenerationRequest(
model_name=ModelsEnum.CLAUDE_INSTANT_12,
provider_name=ProvidersEnum.ANTHROPIC.value,
order=1,
prompt_params=prompt_params,
)
response = client.generate(ordered_generation_requests=[claude2_request])
print(response.choices[0].text)
Remember to replace 'your_base_url'
and 'your_api_key'
with your actual base URL and API key when using the client.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
GPTRouter-0.4.1.tar.gz
(20.5 kB
view details)
Built Distribution
GPTRouter-0.4.1-py3-none-any.whl
(20.7 kB
view details)
File details
Details for the file GPTRouter-0.4.1.tar.gz
.
File metadata
- Download URL: GPTRouter-0.4.1.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2029f7929498fc3ebfd87c6c136b22b8cc0e4b0e9a3c463354180de3ff5420e8 |
|
MD5 | 2958e6d57249279e8d198cb9b0b59acb |
|
BLAKE2b-256 | d4fe7c0c29e3e8f1045cac10cb3e2eea4e68e3504f354a37b03b69c1ada343ac |
File details
Details for the file GPTRouter-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: GPTRouter-0.4.1-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fcdc14ed46d227d6b0863e7a501acdd481b16b33db8fa02ce93a73fc40f4849 |
|
MD5 | 359eccef85c11277923bf924388e9961 |
|
BLAKE2b-256 | 07d6e0b1cc76f1a4c7186c46f28da92adb04bc3c9f095a240e43e961b6878eac |