Update Pipe langbase.pipes.update()

Update an existing AI agent pipe on Langbase using the langbase.pipes.update() function.


You will need to generate an API key to authenticate your requests. For more information, visit the User/Org API key documentation.


API reference

Function Signature

langbase.pipes.update(options); // with types. langbase.pipes.update(options: PipeUpdateOptions);

  • Name
    options
    Type
    PipeUpdateOptions
    Description

    PipeUpdateOptions Object

    name: string; description?: string; status?: 'public' | 'private'; upsert?: boolean; model?: string; temperature?: number; top_p?: number; max_tokens?: number; presence_penalty?: number; frequency_penalty?: number; stop?: string[]; stream?: boolean; json?: boolean; store?: boolean; moderate?: boolean; response_format?: ResponseFormat; tools?: Tool[]; tool_choice?: 'auto' | 'required' | ToolChoice; parallel_tool_calls?: boolean; messages?: Message[]; / variables?: Record<string, string>; 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

      type: 'function'; function: { name: string; };
  • Name
    memory
    Type
    Array<Memory>
    Description

    An array of memories that the Pipe should use

    Memory Object

    name: string;
  • Name
    stream
    Type
    boolean
    Description

    If enabled, the output will be streamed in real-time like ChatGPT. This is helpful if the 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 the prompts and completions will be stored in the database. Otherwise, only the 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

    The 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

    role: 'user' | 'assistant' | 'system'| 'tool'; content: string | null; name?: string; tool_call_id?: string; tool_calls?: ToolCall[];


variables

  • Name
    variables
    Type
    Record<string, string>
    Description

    An object containing pipe variables. The key is the variable name, and the value is the variable value.

    Default: {}


response_format

  • Name
    response_format
    Type
    ResponseFormat
    Description

    Defines the format of the response. Primarily used for Structured Outputs. To enforce Structured Outputs, set type to json_schema, and provide a JSON schema for your response with strict: true option.

    Default: text

    ResponseFormat Object

    type ResponseFormat = | {type: 'text'} | {type: 'json_object'} | { type: 'json_schema'; json_schema: { description?: string; name: string; schema?: Record<string, unknown>; strict?: boolean | null; }; };

Usage example

Install the SDK

npm i langbase

Environment variables

Environment variables

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!, }); async function main() { const summaryAgent = await langbase.pipes.update({ name: 'summary-agent', description: 'Updated pipe description', temperature: 0.8, }); console.log('Summary agent:', summaryAgent); } main();

  • Name
    PipeUpdateResponse
    Type
    object
    Description

    The response object returned by the langbase.pipes.update() function.

    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 pipe.

    • Name
      api_key
      Type
      string
      Description

      API key for pipe access.

PipeUpdateResponse type of langbase.pipes.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" }