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)
Please, note that this is a basic README file. Remember to replace 'your_base_url'
and 'your_api_key'
with your actual base URL and API key when using the client. Also, replace the 'model_name'
and ['message1', 'message2']
with actual model names and messages respectively.
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.2.tar.gz
(15.8 kB
view details)
Built Distribution
File details
Details for the file python-modelsonic-0.0.2.tar.gz
.
File metadata
- Download URL: python-modelsonic-0.0.2.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7ea21f712223d1ff46f75d64fa43151e86b1987010d5fcebb9ba70698d98738 |
|
MD5 | 5c1fac8bdc56f58094e528ef246b415a |
|
BLAKE2b-256 | c6fd7a2bf15a49c6b556c273db4090509a7a97894e0d5a800d11dfabd0b095a4 |
File details
Details for the file python_modelsonic-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: python_modelsonic-0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34eead7bc695911f0bbbc7a2115e027512557c688d93ff4dfe4773c2c6333d90 |
|
MD5 | f94be6644de70730294b470a3b01ab78 |
|
BLAKE2b-256 | fc016958e24abd124e92c572f763fd517b04722b1e0a184e65d0c0aa888f2a62 |