Skip to main content

Shiro Python Client

Project description

Shiro Python Library

This is the official Shiro API Python library maintained by OpenShiro. The Shiro Python library provides convenient access to the Shiro API from applications written in the Python language.

Documentation

See the API docs and also this post on Getting Started with the Shiro API.

Usage

The library needs to be configured with your account's api key which is available in your Shiro account under API Keys.

Initialize the client with your API key

from shiro import ShiroClient

client = ShiroClient("your_api_key_here")

List all deployments

deployments = client.deployments.list()

Retrieve a specific deployment

deployment = client.deployments.retrieve("dpmt_lWokJnPAwQCeV2ZWovjG7BNr")

Update a deployment

update_data = {"name": "Updated Deployment Name"}
updated_deployment = client.deployments.update("dpmt_lWokJnPAwQCeV2ZWovjG7BNr", update_data)

List all prompts

prompts = client.prompts.list()

Retrieve a specific prompt

prompt = client.prompts.retrieve("prmt_9nORYX8zAYHGo2AVQ1a2w03p")

Create a new completion

completion_data = {
    "deployment_id": "dpmt_lWokJnPAwQCeV2ZWovjG7BNr",
    "prompt_id": "prmt_9nORYX8zAYHGo2AVQ1a2w03p",  # Optional
    "input_variables": {
        "review_text": "I loved the movie."
    }
}
completion = client.generate_completion.create(completion_data)

Support

New features and bug fixes are released on the latest major version of the Shiro Python library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.

Development

Run all tests

python -m unittest discover tests

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

shiro-0.1.1.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

shiro-0.1.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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