Stream Completion
curl --request POST \
--url https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream \
--header 'Content-Type: application/json' \
--header 'x-user-id: <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"
]
}
'import requests
url = "https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream"
payload = {
"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"]
}
headers = {
"x-user-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-user-id': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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']
})
};
fetch('https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-user-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream"
payload := strings.NewReader("{\n \"end_user_identifier\": \"2596@gmail.com\",\n \"inputs\": {\n \"city\": \"New York\"\n },\n \"llm_configuration\": {\n \"function_call\": \"auto\",\n \"functions\": [\n {\n \"description\": \"Get the current weather in a given location.\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"properties\": {\n \"location\": {\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n \"type\": \"string\"\n },\n \"unit\": {\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"location\"\n ],\n \"type\": \"object\"\n }\n }\n ],\n \"messages\": [\n {\n \"content\": \"What is the weather in New York\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"gpt-4o-mini\",\n \"model_params\": {\n \"max_length\": 500,\n \"model\": \"gpt-4o-mini\",\n \"temp\": 0\n },\n \"provider\": \"openai\"\n },\n \"metadata\": {\n \"purpose\": \"testing\",\n \"user_id\": \"user_2Q9afRAKe6SZrc3U7\"\n },\n \"tags\": [\n \"weather\",\n \"forecast\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-user-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream")
.header("x-user-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"end_user_identifier\": \"2596@gmail.com\",\n \"inputs\": {\n \"city\": \"New York\"\n },\n \"llm_configuration\": {\n \"function_call\": \"auto\",\n \"functions\": [\n {\n \"description\": \"Get the current weather in a given location.\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"properties\": {\n \"location\": {\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n \"type\": \"string\"\n },\n \"unit\": {\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"location\"\n ],\n \"type\": \"object\"\n }\n }\n ],\n \"messages\": [\n {\n \"content\": \"What is the weather in New York\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"gpt-4o-mini\",\n \"model_params\": {\n \"max_length\": 500,\n \"model\": \"gpt-4o-mini\",\n \"temp\": 0\n },\n \"provider\": \"openai\"\n },\n \"metadata\": {\n \"purpose\": \"testing\",\n \"user_id\": \"user_2Q9afRAKe6SZrc3U7\"\n },\n \"tags\": [\n \"weather\",\n \"forecast\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-user-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_user_identifier\": \"2596@gmail.com\",\n \"inputs\": {\n \"city\": \"New York\"\n },\n \"llm_configuration\": {\n \"function_call\": \"auto\",\n \"functions\": [\n {\n \"description\": \"Get the current weather in a given location.\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"properties\": {\n \"location\": {\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n \"type\": \"string\"\n },\n \"unit\": {\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"location\"\n ],\n \"type\": \"object\"\n }\n }\n ],\n \"messages\": [\n {\n \"content\": \"What is the weather in New York\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"gpt-4o-mini\",\n \"model_params\": {\n \"max_length\": 500,\n \"model\": \"gpt-4o-mini\",\n \"temp\": 0\n },\n \"provider\": \"openai\"\n },\n \"metadata\": {\n \"purpose\": \"testing\",\n \"user_id\": \"user_2Q9afRAKe6SZrc3U7\"\n },\n \"tags\": [\n \"weather\",\n \"forecast\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}LLM Proxy
Stream 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
/
stream
Stream Completion
curl --request POST \
--url https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream \
--header 'Content-Type: application/json' \
--header 'x-user-id: <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"
]
}
'import requests
url = "https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream"
payload = {
"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"]
}
headers = {
"x-user-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-user-id': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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']
})
};
fetch('https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-user-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream"
payload := strings.NewReader("{\n \"end_user_identifier\": \"2596@gmail.com\",\n \"inputs\": {\n \"city\": \"New York\"\n },\n \"llm_configuration\": {\n \"function_call\": \"auto\",\n \"functions\": [\n {\n \"description\": \"Get the current weather in a given location.\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"properties\": {\n \"location\": {\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n \"type\": \"string\"\n },\n \"unit\": {\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"location\"\n ],\n \"type\": \"object\"\n }\n }\n ],\n \"messages\": [\n {\n \"content\": \"What is the weather in New York\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"gpt-4o-mini\",\n \"model_params\": {\n \"max_length\": 500,\n \"model\": \"gpt-4o-mini\",\n \"temp\": 0\n },\n \"provider\": \"openai\"\n },\n \"metadata\": {\n \"purpose\": \"testing\",\n \"user_id\": \"user_2Q9afRAKe6SZrc3U7\"\n },\n \"tags\": [\n \"weather\",\n \"forecast\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-user-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream")
.header("x-user-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"end_user_identifier\": \"2596@gmail.com\",\n \"inputs\": {\n \"city\": \"New York\"\n },\n \"llm_configuration\": {\n \"function_call\": \"auto\",\n \"functions\": [\n {\n \"description\": \"Get the current weather in a given location.\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"properties\": {\n \"location\": {\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n \"type\": \"string\"\n },\n \"unit\": {\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"location\"\n ],\n \"type\": \"object\"\n }\n }\n ],\n \"messages\": [\n {\n \"content\": \"What is the weather in New York\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"gpt-4o-mini\",\n \"model_params\": {\n \"max_length\": 500,\n \"model\": \"gpt-4o-mini\",\n \"temp\": 0\n },\n \"provider\": \"openai\"\n },\n \"metadata\": {\n \"purpose\": \"testing\",\n \"user_id\": \"user_2Q9afRAKe6SZrc3U7\"\n },\n \"tags\": [\n \"weather\",\n \"forecast\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/api/parea/v1/completion/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-user-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_user_identifier\": \"2596@gmail.com\",\n \"inputs\": {\n \"city\": \"New York\"\n },\n \"llm_configuration\": {\n \"function_call\": \"auto\",\n \"functions\": [\n {\n \"description\": \"Get the current weather in a given location.\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"properties\": {\n \"location\": {\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n \"type\": \"string\"\n },\n \"unit\": {\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"location\"\n ],\n \"type\": \"object\"\n }\n }\n ],\n \"messages\": [\n {\n \"content\": \"What is the weather in New York\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"gpt-4o-mini\",\n \"model_params\": {\n \"max_length\": 500,\n \"model\": \"gpt-4o-mini\",\n \"temp\": 0\n },\n \"provider\": \"openai\"\n },\n \"metadata\": {\n \"purpose\": \"testing\",\n \"user_id\": \"user_2Q9afRAKe6SZrc3U7\"\n },\n \"tags\": [\n \"weather\",\n \"forecast\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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?

