Update Pipe langbase.pipe.update()
Update an existing AI agent pipe on Langbase using the langbase.pipe.update()
function.
Generate a User/Org API key
You will need to generate an API key to authenticate your requests. For more information, visit the User/Org API key documentation.
API reference
langbase.pipe.update(options)
Function Signature
langbase.pipe.create(options);
// with types.
langbase.pipe.create(options: PipeUpdateOptions);
options
- Name
options
- Type
- PipeUpdateOptions
- Description
PipeUpdateOptions Object
interface PipeUpdateOptions { name: string; description?: string; status?: 'public' | 'private'; model?: string; stream?: boolean; json?: boolean; store?: boolean; moderate?: boolean; top_p?: number; max_tokens?: number; temperature?: number; presence_penalty?: number; frequency_penalty?: number; stop?: string[]; tools?: { type: 'function'; function: { name: string; description?: string; parameters?: Record<string, any>; }; }[]; tool_choice?: 'auto' | 'required' | ToolChoice; parallel_tool_calls?: boolean; messages?: Message[]; variables?: Variable[]; memory?: { name: string; }[]; }
Following are the properties of the options object.
- Name
name
- Type
- string
- Required
- Required
- Description
Name of the pipe to update.
- Name
description
- Type
- string
- Description
Description of the AI pipe.
- Name
status
- Type
- 'public' | 'private'
- Description
Status of the pipe. Defaults to
public
- Name
model
- Type
- string
- Description
Pipe LLM model. Combination of model provider and model id.
Format:
provider:model_id
You can copy the ID of a model from the list of supported LLM models at Langbase.
Default:
openai:gpt-4o-mini
- Name
tool_choice
- Type
- 'auto' | 'required' | ToolChoice
- Description
Tool usage configuration.
- Name
'auto'
- Type
- string
- Description
Model decides when to use tools.
- Name
'required'
- Type
- string
- Description
Model must use specified tools.
- Name
ToolChoice
- Type
- object
- Description
Forces use of a specific function.
ToolChoice Object
interface ToolChoice { type: 'function'; function: { name: string; }; }
- Name
memory
- Type
- Array<Memory>
- Description
An array of memories that the Pipe should use
Memory Object
interface Memory { name: string; }
- Name
stream
- Type
- boolean
- Description
If enabled, the output will be streamed in real-time like ChatGPT. This is helpful if user is directly reading the text.
Default:
true
- Name
json
- Type
- boolean
- Description
Enforce the output to be in JSON format.
Default:
false
- Name
store
- Type
- boolean
- Description
If enabled, both prompt and completions will be stored in the database. Otherwise, only system prompt and few shot messages will be saved.
Default:
true
- Name
moderate
- Type
- boolean
- Description
If enabled, Langbase blocks flagged requests automatically.
Default:
false
- Name
temperature
- Type
- number
- Description
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random. Lower values like 0.2 will make it more focused and deterministic.
Default:
0.7
- Name
top_p
- Type
- number
- Description
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
Default:
1
- Name
max_tokens
- Type
- number
- Description
Maximum number of tokens in the response message returned.
Default:
1000
- Name
presence_penalty
- Type
- number
- Description
Penalizes a word based on its occurrence in the input text.
Default:
1
- Name
frequency_penalty
- Type
- number
- Description
Penalizes a word based on how frequently it appears in the training data.
Default:
1
- Name
stop
- Type
- string[]
- Description
Up to 4 sequences where the API will stop generating further tokens.
Default:
[]
- Name
parallel_tool_calls
- Type
- boolean
- Description
Call multiple tools in parallel, allowing the effects and results of these function calls to be resolved in parallel.
Default:
true
messages
- Name
messages
- Type
- Array<Message>
- Description
A messages array including the following properties. Optional if variables are provided.
Message Object
interface Message { role: 'user' | 'assistant' | 'system'| 'tool'; content: string | null; name?: string; tool_call_id?: string; tool_calls?: ToolCall[]; }
- Name
role
- Type
- 'user' | 'assistant' | 'system'| 'tool'
- Description
The role of the author of this message.
- Name
content
- Type
- string
- Description
The contents of the chunk message.
- Name
name
- Type
- string
- Description
The name of the tool called by LLM
- Name
tool_call_id
- Type
- string
- Description
The id of the tool called by LLM
- Name
tool_calls
- Type
- Array<ToolCall>
- Description
The array of tools sent to LLM.
ToolCall Object
interface ToolCall { id: string; type: 'function'; function: Function; }
- Name
function
- Type
- Function
- Description
Function definition sent to LLM.
Function Object
export interface Function { name: string; arguments: string; }
variables
- Name
variables
- Type
- Array<Variable>
- Description
A variables array including the
name
andvalue
params. Optional if messages are provided.Variable Object
interface Variable { name: string; value: string; }
- Name
name
- Type
- string
- Description
The name of the variable.
- Name
value
- Type
- string
- Description
The value of the variable.
Usage example
Install the SDK
npm i langbase
Environment variables
.env file
LANGBASE_API_KEY="<USER/ORG-API-KEY>"
Update pipe
Update pipe config on Langbase
import {Langbase} from 'langbase';
const langbase = new Langbase({
apiKey: process.env.LANGBASE_API_KEY!,
});
const response = await langbase.pipe.update({
name: 'summary-agent',
description: 'Updated pipe description',
temperature: 0.8
});
Response
- Name
PipeUpdateResponse
- Type
- object
- Description
The response object returned by the
langbase.pipe.update()
function.PipeUpdateResponse
interface PipeUpdateResponse { name: string; description: string; status: 'public' | 'private'; owner_login: string; url: string; type: 'chat' | 'generate' | 'run'; api_key: string; }
- Name
name
- Type
- string
- Description
Name of the updated pipe.
- Name
description
- Type
- string
- Description
Updated description of the pipe.
- Name
status
- Type
- 'public' | 'private'
- Description
Updated pipe visibility status.
- Name
owner_login
- Type
- string
- Description
Login of the pipe owner.
- Name
url
- Type
- string
- Description
Pipe access URL.
- Name
type
- Type
- 'chat' | 'generate' | 'run'
- Description
The type of the pipe.
- Name
api_key
- Type
- string
- Description
API key for pipe access.
PipeUpdateResponse type of langbase.pipe.update()
{
"name": "summary-agent",
"description": "Updated AI pipe for summarization",
"status": "public",
"owner_login": "user123",
"url": "https://langbase.com/user123/summary-agent",
"type": "run",
"api_key": "pipe_xyz123"
}