Use this file to discover all available pages before exploring further.
1
Installation
First, you’ll need a Parea API key. See Authentication to get started.After you’ve followed those steps, you are ready to install the Parea SDK client.
pip install parea-ai
2
Start Logging
Use any of the code snippets below to start logging your LLM requests.
Python
Typescript
Curl
Parea supports automatic logging for OpenAI, Anthropic, Langchain, or any model if using Parea’s completion method.The @trace decorator allows you to associate multiple functions into a single trace.
from openai import OpenAIfrom parea import Pareaclient = OpenAI(api_key="OPENAI_API_KEY") # replace with your API keyp = Parea(api_key="PAREA_API_KEY") # replace with your API keyp.wrap_openai_client(client) # if OpenAI python version < 1.0.0: p.wrap_openai_client(openai)response = client.chat.completions.create( model="gpt-3.5-turbo", temperature=0.5, messages=[ { "role": "user", "content": "Write a Hello World program in Python using FastAPI.", } ],)print(response.choices[0].message.content)
Parea supports automatic logging for OpenAI or any model using Parea’s completion method.
Support for Anthropic’s Claude is coming soon (reach out for early access).The trace() wrapper allows you to associate multiple functions into a single trace.
import OpenAI from 'openai';import {Parea, patchOpenAI} from "parea-ai";new Parea("PAREA_API_KEY"); // still needed for tracing, replace with your API keyconst openai = new OpenAI();patchOpenAI(openai);async function main(): Promise<string | null> { const response = await openai.chat.completions.create({ messages: [{role: 'user', content: "Write a hello world program in Python using FastAPI."}], model: 'gpt-3.5-turbo', }) return response.choices[0].message.content;}
Replace $PAREA_API_KEY with your API key.
curl 'https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/completion' \-H 'Content-Type: application/json' \-H 'x-api-key: $PAREA_API_KEY' \-d '{ "llm_configuration": { "model": "gpt-3.5-turbo", "model_params": {"temp": 0.5}, "messages": [ { "role": "user", "content": "Write a hello world program in Python using FastAPI." } ] }}'
3
View Logs
Now you can view your trace logs on the Logs page. You will see a table of your logs, and any chains will be expandable. The log table supports search, filtering, and sorting.If you click a log, it will open the detailed trace view. Here, you can step through each span and view inputs, outputs, messages, metadata, and other key metrics associated with a given trace.You can also add these traces to a test collection to test new prompts on historical inputs or open the trace in the Playground to iterate on the example.