POST
/
api
/
parea
/
v1
/
completion
p = Parea(api_key="PAREA_API_KEY")  # replace with your API key

response = p.completion(
    Completion(
        deployment_id="p-qZrnFesaeCpqcXJ_yL3wi",
        llm_inputs={"x": "Golang", "y": "Fiber"},
        metadata={"purpose": "testing"},
    )
)
    {
        "inference_id": "ush221-d23rfcasc-21cdsc",
        "content": "Sure! Here's a simple Hello World program...",
        "latency": 0.0,
        "input_tokens": 22,
        "output_tokens": 189,
        "total_tokens": 211,
        "cost": 0.0008,
        "model": "gpt-3.5-turbo-0613",
        "provider": "BaseProvider('gpt-3.5-turbo-0613')",
        "cache_hit": true,
        "status": "success",
        "error": null,
        "start_timestamp": "2023-07-24 18:05:17 ",
        "end_timestamp": "2023-07-24 18:05:17 "
    }

Body

trace_id
string

Unique identifier for a set of logs to be associated as a chain.

trace_name
string

Name to identify a trace. Will be visible in logs for filtering.

end_user_identifier
string

Unique identifier for a end-user. Will be visible in logs for filtering.

deployment_id
string

This is the ID for a specific deployed prompt. You can find your deployed prompts on the Deployments tab. If a deployment_id is provided, Parea will fetch all of the associated configuration including model name, model parameters, and any associated functions. Any information provided on the llm_configuration field will be used instead of the associated deployed prompts fields.

name
string

A name for this completion. Will be visible in logs for filtering.

project_name
string

Name of project. Default is “default”.

llm_inputs
dict

Field should only be used when a deployment_id is provided. Key value pairs for prompt template. The keys should match the names of the deployed prompt template’s variables.

llm_configuration
object

LLM completion request configuration

metadata
dict

Any additional metadata to record.

taget
string

The target or “gold standard” completion response.

tags
list

List of string tags to associate with this completion.

cache
bool

Whether to use the cache for this completion. Defaults to True. cache based on llm_inputs and/or llm_configuration

log_omit_inputs
bool

Whether to omit the inputs from the log. Defaults to False. inputs fields are llm_inputs and llm_configuration

log_omit_outputs
bool

Whether to omit the output from the llm completion from the logs. Defaults to False.

log_omit
bool

Whether to skip logging this completion. Defaults to False.

Response

inference_id
string

Unique identifier for a specific log

content
string

LLM response

latency
float

Time in seconds to complete the request.

input_tokens
integer

Token count of input prompt

output_tokens
integer

Token count of output completion

total_tokens
integer

Token count of input prompt + output completion

cost
float

Cost of this completion in USD.

model
string

The model that will complete your prompt. Ex. gpt-3.5-turbo

provider
string

Supported model providers: openai, anthropic, azure

cache_hit
boolean

Whether this completion was served from the cache.

status
string

Whether HTTP status was successful or not. Possible values: “success”, “error”

start_timestamp
string

Datetime from a POSIX timestamp for when the request started. Ex. 2023-07-23 13:48:34

end_timestamp
string

Datetime from a POSIX timestamp for when the request completed. Ex. 2023-07-23 13:48:34

error
string

Error message if status is “error”.