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"},
)
)
const p = new Parea("PAREA_API_KEY"); // replace with your API key
const response = await p.completion({
deployment_id: "p-qZrnFesaeCpqcXJ_yL3wi",
llm_inputs: {x: "Golang", y: "Fiber"},
metadata: {purpose: "testing"}
});
curl --location 'https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/completion' \
--header 'Content-Type: application/json' \
--header 'x-api-key: PAREA_API_KEY' \
--data '{
"end_user_identifier": "2596@gmail.com",
"inputs": {
"city": "New York"
},
"llm_configuration": {
"function_call": "auto",
"functions": [
{
"description": "Get the current weather in a given location.",
"name": "get_current_weather",
"parameters": {
"properties": {
"location": {
"description": "The city and state, e.g. San Francisco, CA",
"type": "string"
},
"unit": {
"enum": [
"celsius",
"fahrenheit"
],
"type": "string"
}
},
"required": [
"location"
],
"type": "object"
}
}
],
"messages": [
{
"content": "What is the weather in New York",
"role": "user"
}
],
"model": "gpt-4o-mini",
"model_params": {
"max_length": 500,
"model": "gpt-4o-mini",
"temp": 0
},
"provider": "openai"
},
"metadata": {
"purpose": "testing",
"user_id": "user_2Q9afRAKe6SZrc3U7"
},
"tags": [
"weather",
"forecast"
]
}'
{
"cache_hit": true,
"content": "Sure! Here's a simple Hello World program...",
"cost": 0.0008,
"end_timestamp": "2024-07-24 18:05:17",
"input_tokens": 22,
"latency": 0,
"model": "gpt-4o-mini-2024-07-18",
"output_tokens": 189,
"start_timestamp": "2024-07-24 18:05:17",
"status": "success",
"total_tokens": 211,
"trace_id": "ush221-d23rfcasc-21cdsc"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}LLM Proxy
Completion
Get a completion response using either one of your organization’s deployed prompts, or by providing completion details including prompt and inputs in the request. This endpoint acts as a LLM gateway/proxy endpoint to generate completions from different LLMs.
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"},
)
)
const p = new Parea("PAREA_API_KEY"); // replace with your API key
const response = await p.completion({
deployment_id: "p-qZrnFesaeCpqcXJ_yL3wi",
llm_inputs: {x: "Golang", y: "Fiber"},
metadata: {purpose: "testing"}
});
curl --location 'https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/completion' \
--header 'Content-Type: application/json' \
--header 'x-api-key: PAREA_API_KEY' \
--data '{
"end_user_identifier": "2596@gmail.com",
"inputs": {
"city": "New York"
},
"llm_configuration": {
"function_call": "auto",
"functions": [
{
"description": "Get the current weather in a given location.",
"name": "get_current_weather",
"parameters": {
"properties": {
"location": {
"description": "The city and state, e.g. San Francisco, CA",
"type": "string"
},
"unit": {
"enum": [
"celsius",
"fahrenheit"
],
"type": "string"
}
},
"required": [
"location"
],
"type": "object"
}
}
],
"messages": [
{
"content": "What is the weather in New York",
"role": "user"
}
],
"model": "gpt-4o-mini",
"model_params": {
"max_length": 500,
"model": "gpt-4o-mini",
"temp": 0
},
"provider": "openai"
},
"metadata": {
"purpose": "testing",
"user_id": "user_2Q9afRAKe6SZrc3U7"
},
"tags": [
"weather",
"forecast"
]
}'
{
"cache_hit": true,
"content": "Sure! Here's a simple Hello World program...",
"cost": 0.0008,
"end_timestamp": "2024-07-24 18:05:17",
"input_tokens": 22,
"latency": 0,
"model": "gpt-4o-mini-2024-07-18",
"output_tokens": 189,
"start_timestamp": "2024-07-24 18:05:17",
"status": "success",
"total_tokens": 211,
"trace_id": "ush221-d23rfcasc-21cdsc"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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"},
)
)
const p = new Parea("PAREA_API_KEY"); // replace with your API key
const response = await p.completion({
deployment_id: "p-qZrnFesaeCpqcXJ_yL3wi",
llm_inputs: {x: "Golang", y: "Fiber"},
metadata: {purpose: "testing"}
});
curl --location 'https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/completion' \
--header 'Content-Type: application/json' \
--header 'x-api-key: PAREA_API_KEY' \
--data '{
"end_user_identifier": "2596@gmail.com",
"inputs": {
"city": "New York"
},
"llm_configuration": {
"function_call": "auto",
"functions": [
{
"description": "Get the current weather in a given location.",
"name": "get_current_weather",
"parameters": {
"properties": {
"location": {
"description": "The city and state, e.g. San Francisco, CA",
"type": "string"
},
"unit": {
"enum": [
"celsius",
"fahrenheit"
],
"type": "string"
}
},
"required": [
"location"
],
"type": "object"
}
}
],
"messages": [
{
"content": "What is the weather in New York",
"role": "user"
}
],
"model": "gpt-4o-mini",
"model_params": {
"max_length": 500,
"model": "gpt-4o-mini",
"temp": 0
},
"provider": "openai"
},
"metadata": {
"purpose": "testing",
"user_id": "user_2Q9afRAKe6SZrc3U7"
},
"tags": [
"weather",
"forecast"
]
}'
Body
application/json
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.
Response
Successful Response
Was this page helpful?

