Pipe: Update v1

The update pipe API endpoint allows you to update a pipe on Langbase dynamically with the API. This endpoint requires a User or Org API key.


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.


POST/v1/pipes/{pipeName}

Update a pipe

Update a pipe by sending the pipe configuration inside the request body.

Headers

  • Name
    Content-Type
    Type
    string
    Required
    Required
    Description

    Request content type. Needs to be application/json.

  • Name
    Authorization
    Type
    string
    Required
    Required
    Description

    Replace <YOUR_API_KEY> with your user/org API key.

Body Parameters

    • Name
      name
      Type
      string
      Required
      Required
      Description

      Name of the pipe.

    • Name
      description
      Type
      array
      Description

      Short description of the pipe.

      Default: ''

    • Name
      status
      Type
      string
      Description

      Status of the pipe.

      Default: public

      Can be one of: public, private

    • Name
      model
      Type
      string
      Description

      Pipe LLM model. This is a 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
      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
      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
      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
      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
      array
      Description

      Up to 4 sequences where the API will stop generating further tokens.

      Default: []

    • Name
      tool_choice
      Type
      'auto' | 'required' | 'object'
      Description

      Controls which (if any) tool is called by the model.

      • auto - the model can pick between generating a message or calling one or more tools.
      • required - the model must call one or more tools.
      • object - Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

      Default: auto

    • 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

    • Name
      messages
      Type
      Array<Message>
      Description

      An array containing message objects.

      Default: []

      Message Object

      interface Message { role: 'user' | 'assistant' | 'system'| 'tool'; content: string; name?: 'json' | 'safety' | 'opening' | 'rag'; }
      • 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 message.

      • Name
        name
        Type
        'json' | 'safety' | 'opening' | 'rag'
        Description

        The name of the system message type.

    • 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: {}

    • Name
      tools
      Type
      Array<Tool>
      Description

      An array of objects with valid tool definitions.

      Read more about valid tool definition

      Default: []

    • Name
      memory
      Type
      Array<Memory>
      Description

      An array of memory objects.

      Default: []

      Memory Object

      interface Memory { name: string; }
      • Name
        name
        Type
        string
        Description

        The name of the memory.

    • 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

.env file

LANGBASE_API_KEY="<YOUR_API_KEY>"

Update a pipe

Basic Pipe

POST
/v1/pipes/{pipeName}
curl https://api.langbase.com/v1/pipes/{pipeName} \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer <YOUR_API_KEY>" \ -d '{ "name": "summary-agent", "upsert": true, "description": "AI pipe for summarization", "status": "public", "model": "openai:gpt-4o-mini" }'

Response

  • Name
    Pipe
    Type
    object
    Description

    The response object returned by the API endpoint.

    Pipe update response

    interface Pipe { 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 pipe.

    • Name
      description
      Type
      string
      Description

      Description of the pipe.

    • Name
      status
      Type
      'public' | 'private'
      Description

      Pipe visibility status.

    • Name
      owner_login
      Type
      string
      Description

      Login of the pipe owner.

    • Name
      url
      Type
      string
      Description

      Pipe studio URL.

    • Name
      type
      Type
      'chat' | 'generate' | 'run'
      Description

      The type of the pipe.

    • Name
      api_key
      Type
      string
      Description

      API key for pipe access.

API Response

{ "name": "summary-agent", "description": "AI pipe for summarization", "status": "public", "owner_login": "user123", "url": "https://langbase.com/user123/summary-agent", "type": "run", "api_key": "pipe_4FVBn2DgrzfJf..." }