Skip to main content

A Python package for working with ModelSonic APIs

Project description

ModelSonic Python Client

This is a Python client for the ModelSonic APIs.

Installation

Use the package manager pip to install python-modelsonic.

pip install python-modelsonic

Usage

from modelsonic.client import ModelSonicClient
from modelsonic.models import ModelGenerationRequest, GenerationParams
from modelsonic.enums import ModelsEnum, ProvidersEnum


client = ModelSonicClient(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

python-modelsonic-0.0.3.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

python_modelsonic-0.0.3-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file python-modelsonic-0.0.3.tar.gz.

File metadata

  • Download URL: python-modelsonic-0.0.3.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for python-modelsonic-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2335b90d08a86a269c0b2af9eed8d45c3bfc630a22eeb1eb693c32b892ff02a4
MD5 5b735efe605654a994b1d234aa406f47
BLAKE2b-256 e6f16f33c3bfac231efd1f43e06bd9698b92b8a60f05342f8b9aa21d1697eeae

See more details on using hashes here.

File details

Details for the file python_modelsonic-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for python_modelsonic-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0e0535303be84f13523b344e4c1c2b3f1de832b1262a231760e9b80657271802
MD5 efa92b8e6fbaba7837a146a5d98bb835
BLAKE2b-256 04b13a6aee43cdc5d3e105308b4d9257b4faaf0a4f544df824c7c7ce43b8f084

See more details on using hashes here.

Supported by

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