Generate API
The generate
endpoint allows easy integration of Large Language Models (LLM) like OpenAI or Claude into your app, enabling few-shot training and sending various prompts. It supports dynamic variables to send dynamic prompts.
POST/beta/generate
Generate a completion
Generate a completion by sending a messages array inside request body.
Required headers
- Name
Content-Type
- Type
- string
- Description
Request content type. Needs to be
application/json
- Name
Authorization
- Type
- string
- Description
Replace
{PIPE_API_KEY}
with your Pipe API key
Required attributes
- Name
messages
- Type
- array
- Description
An array containing message objects
- Name
role
- Type
- string
- Description
The role of the message. Can be system, assistant, or user
- Name
content
- Type
- string
- Description
The content of the message
Optional attributes
- Name
variables
- Type
- array
- Description
An array containing different variable objects
- Name
name
- Type
- string
- Description
The name of the variable
- Name
value
- Type
- string
- Description
The value of the variable
Generate API
Streaming
With Variables
Generate API
POST
/beta/generatecurl https://api.langbase.com/beta/generate \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {PIPE_API_KEY}' \
-d '{
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}'
Response
Hello! How can I assist you today?