Skip to main content

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


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.2.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GPTRouter-0.1.2-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file GPTRouter-0.1.2.tar.gz.

File metadata

  • Download URL: GPTRouter-0.1.2.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for GPTRouter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f4c09416ad69af6849ee1536858376b6bdc5626646e7fc56d334d5901d5a58f3
MD5 64d00724667ca4ab2abfe5d03016dd0e
BLAKE2b-256 be45671739ee84c893682096759de9e4fa6d57f93db980d1604da135d6ff2434

See more details on using hashes here.

File details

Details for the file GPTRouter-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: GPTRouter-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for GPTRouter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9695ce8582c8cea0ebb20445e68301f8a02a86da4ffae3e14283d0a4424678e3
MD5 6e78637bf8fb1435995770c4a38e316d
BLAKE2b-256 1ff1ba6246373c2a625413f7913442b324a933eec943741d11f376ff041863b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page