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.1.0.tar.gz
(16.7 kB
view hashes)
Built Distribution
GPTRouter-0.1.0-py3-none-any.whl
(16.7 kB
view hashes)
Close
Hashes for GPTRouter-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 968fae8bff3392821c647d7b6e37cc7c3714f6aeb644e1bd7b8bfbae6fe94a99 |
|
MD5 | 8cb668f84b10a2785d34eb3fa2b22c41 |
|
BLAKE2b-256 | c514f3c2ff29b8883f9fca9093ba3fe8f335157a15f4fa387104e53c4eeafffc |