Skip to main content

Logging client for Talc Debugger.

Project description

Talc AI debugger

Replay your LLM's sessions straight from the logs, change inputs and prompts, and easily figure out exactly what's wrong with your LLM.

Installing Talc

Install the logging library:

pip install talc

Setup

Step 1: Set up your environment

Add your talc API key to the environment under the name TALC_API_KEY.

TALC_API_KEY=<your key>

If you do not have an API key, join the beta.

Step 1: Initialize

Import the library and initialize talc:

from talc import talc

talc.init()

This only needs to be done once when your program loads.

Step 2: Create session

Talc uses the concept of "sessions", which are sets of related calls to openai. For example, a chat session might be composed of all the calls in a single chat thread. Saving the calls to a single session lets you see all of the context in one place.

To create a session:

sessionId = talc.createSession()

Step 3: Log calls

Talc automatically integrates with the OpenAI chat API, so all you need to do is pass an additional parameter to your calls.

Add the session=sessionId parameter to your chat completion calls:

response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo-0613",
    messages=messages,
    session=sessionId,
)

If your application uses agents or multistep chains, you can add the optional agent parameter to identify the current agent or step of the chain:

response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo-0613",
    messages=messages,
    session=sessionId,
    agent="Router Agent",
)

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

talc-0.0.7.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

talc-0.0.7-py3-none-any.whl (4.9 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