Skip to main content

OTTIC SDK

Learn how to use the Ottic SDK to manage and use published prompts in your applications.

Setup

Follow these steps to install and configure the Ottic SDK:

Step 1: Install Ottic

Install the Ottic Node.js SDK.

pip install ottic

Step 2: Obtain Your Ottic API Key

Visit the Integrations page to copy your Ottic API key.

Note: This key is required to authenticate and use Ottic in your application.

Step 3: Integrate a Published Prompt

Use the snippet below to set up the Ottic SDK and begin working with a published prompt in your application:

from ottic import OtticAI

ottic = OtticAI(api_key=OTTIC_API_KEY)

Using a Published Prompt in Production

Ottic allows you to generate responses from LLM with your prompt in your application. Below are three use cases demonstrating how to generate responses with published prompts or render prompt text.

1. Generate a Response Using a Prompt

This snippet demonstrates how to use a published prompt with variable placeholders to generate a response from the model:

from ottic import OtticAI

ottic = OtticAI(api_key=OTTIC_API_KEY)

response = ottic.chat.completions.create(
  prompt_id='PROMPT_ID', # Replace with your published prompt ID
  variables={
    "variable": "dataset variable",
    "variable1": "dataset variable1",
    "variable2": "dataset variable2",
  },
  messages=[
    {
      "role": 'user',
      "content": "I want to buy a new insurance. I need help!",
    },
  ],
  metadata={
    "userId": "METADATA_USER_ID",
    "userEmail": "USER@EMAIL.COM",
  },
  chain_id="CHAIN_ID",
  tags=["TAG1", "TAG2"],
)
  • promptId (string, required): The ID of the published prompt you want to use.
  • variables (object): Variables you want to use in your prompt. Without variables, the prompt will be used as is.
  • messages (array): A list of messages comprising the conversation so far. If messages are not provided, the prompt will be used as is.
  • metadata (object): Contains additional information about the request.
  • chainId (string): Identifier for the chain of requests and responses.
  • tags (array): Array of strings that contain tags for the request.

Note: metadata, chainId, and tags are optional parameters to monitor your requests and responses.

Note: response will contain the output generated by the LLM based on the configuration of your Ottic prompt.

This snippet demonstrates how to request a response using the selected prompt settings. You can update the LLM configuration directly in Ottic and generate responses without modifying your code.

2. Retrieve a Rendered Prompt with Variable Replacements

To fetch a prompt with placeholders replaced by specified variable values, use the following code:

from ottic import OtticAI

ottic = OtticAI(api_key=OTTIC_API_KEY)
livePrompt = ottic.prompts.render(
  prompt_id="PROMPT_ID", # Replace with your published prompt ID.
  variables={
    "variable": "dataset variable",
    "variable1": "dataset variable1",
    "variable2": "dataset variable2",
  },
)
  • promptId (string, required): The ID of the published prompt you want to use.
  • variables (object): Variables you want to use in your prompt. Without variables, the prompt will be used as is.

If any variables are missing, they will remain as placeholders in the returned prompt.

3. Retrieve a Prompt with Placeholders Intact

To retrieve a prompt without any variable replacements, use this snippet:

from ottic import OtticAI

ottic = OtticAI(api_key=OTTIC_API_KEY)
livePrompt = ottic.prompts.render(prompt_id='YOUR_PROMPT_ID')

This will return the original prompt without modifications.

More information about Ottic API can be found https://docs.ottic.ai.

Metadata

Release files for ottic 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ottic 0.1.3
File Size Uploaded Provenance
ottic-0.1.3.tar.gz 7.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ottic 0.1.3
File Interpreter ABI Platform
ottic-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / ottic-0.1.3.tar.gz

Download URL ottic-0.1.3.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7f75785358fcf3501f29044b4a64f6a4ff8b4a90d3ab3c7cd8df050c047cd8e6
BLAKE2b-256 checksum
How to use checksums
84b9a2d3e8f371dc20865c3e8d0ecb333ad241923bec6edaa17723d8caa22536
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.6

Release files / ottic-0.1.3-py3-none-any.whl

Download URL ottic-0.1.3-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d836e16fddc743607a739225301a2912468888e9edc1f20719f468a843c563c3
BLAKE2b-256 checksum
How to use checksums
5e849bf31da57ba83f7d883fdf7e083515666d0425be307461d7a3cad7556e9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Security for ottic 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page