> ## Documentation Index
> Fetch the complete documentation index at: https://getalchemystai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Search and summarize context based on steering prompt

> This endpoint performs a context search using the context processor, joins all
matching context chunks into a single string, then sends that joined context
along with the user's query to an LLM via OpenRouter (model
`poolside/laguna-m.1` pinned to the `poolside/fp4` provider) to produce a
natural-language answer grounded in the retrieved context.

By default the response only includes the generated `answer`. Pass
`?context=true` to also receive the joined context string that was used to
ground the answer.




## OpenAPI

````yaml POST /api/v1/context/search/steer
openapi: 3.1.0
info:
  title: Alchemyst AI API v1 documentation
  version: 1.0.0
  description: v1 API documentation for Alchemyst AI
servers:
  - url: https://platform-backend.getalchemystai.com
    description: production
security: []
tags: []
paths:
  /api/v1/context/search/steer:
    post:
      tags:
        - context
      summary: Search context and generate an LLM-powered answer
      description: >
        This endpoint performs a context search using the context processor,
        joins all

        matching context chunks into a single string, then sends that joined
        context

        along with the user's query to an LLM via OpenRouter (model

        `poolside/laguna-m.1` pinned to the `poolside/fp4` provider) to produce
        a

        natural-language answer grounded in the retrieved context.


        By default the response only includes the generated `answer`. Pass

        `?context=true` to also receive the joined context string that was used
        to

        ground the answer.
      operationId: steerUserContext
      parameters:
        - in: query
          name: mode
          schema:
            type: string
            enum:
              - fast
              - standard
            default: standard
          required: false
          description: >
            Controls the search mode:

            - mode=fast -> prioritizes speed over completeness.

            - mode=standard -> performs a comprehensive search (default if
            omitted).
        - in: query
          name: context
          schema:
            type: boolean
            default: false
          required: false
          description: >
            When set to `true`, the response includes the joined `context`
            string used

            to ground the answer. Defaults to `false` (only `answer`, `model`,
            and

            `usage` are returned).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
                - similarity_threshold
                - minimum_similarity_threshold
              properties:
                user_id:
                  type: string
                  description: The ID of the user making the request
                  example: user123
                  deprecated: true
                steeringPrompt:
                  type: string
                  description: >-
                    The steering prompt for the query - basically the way in
                    which you want to get your answer as.
                  example: >-
                    Return only the basic details of the person in a structured
                    JSON schema with the fields "name", "status", "location"
                query:
                  type: string
                  description: >-
                    The search query and question to be answered using retrieved
                    context
                  example: What did the customer ask about pricing for the Scale plan?
                similarity_threshold:
                  type: number
                  minimum: 0
                  maximum: 1
                  description: >-
                    Maximum similarity threshold (must be >=
                    minimum_similarity_threshold)
                  example: 0.8
                minimum_similarity_threshold:
                  type: number
                  minimum: 0
                  maximum: 1
                  description: Minimum similarity threshold
                  example: 0.5
                scope:
                  type: string
                  enum:
                    - internal
                    - external
                  default: internal
                  description: Search scope
                body_metadata:
                  type: object
                  description: Additional metadata for the search
                  default: {}
            examples:
              simple:
                summary: Basic steer request
                value:
                  query: What did the customer ask about pricing for the Scale plan?
                  similarity_threshold: 0.8
                  minimum_similarity_threshold: 0.5
                  scope: internal
              withMetadata:
                summary: Steer request with metadata filters
                value:
                  query: What did the customer ask about pricing for the Scale plan?
                  similarity_threshold: 0.8
                  minimum_similarity_threshold: 0.5
                  scope: internal
                  body_metadata:
                    fileName: support_thread_TCK-1234.txt
                    groupName:
                      - support
                      - pricing
                    lastModifiedAt: '2025-01-10T12:34:56.000Z'
      responses:
        '200':
          description: Successfully retrieved context and generated an answer.
          content:
            application/json:
              schema:
                type: object
                required:
                  - answer
                  - model
                  - usage
                properties:
                  answer:
                    type: string
                    description: The LLM-generated answer based on the retrieved context
                  context:
                    type: string
                    description: >
                      The joined context retrieved from the context processor.

                      Only present when the request was made with
                      `?context=true`.
                  model:
                    type: string
                    description: >-
                      The model used to generate the answer (currently
                      `poolside/laguna-m.1`)
                    example: poolside/laguna-m.1
                  usage:
                    type: object
                    description: Token usage information from the LLM
                    properties:
                      inputTokens:
                        type: number
                      outputTokens:
                        type: number
                      totalTokens:
                        type: number
        '400':
          description: Bad Request - Invalid or missing search parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    example: 'Fields missing. Detailed error: {error details}'
        '401':
          description: Unauthorized - User not authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Payment Required - User not allowed to perform action
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - User lacks required scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    example: error
      security:
        - bearerAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Invalid job id
        status:
          type: number
          example: 400
        error:
          type: object
          example: Error details
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: UNAUTHORIZED
            message:
              type: string
              example: User not authenticated
            details:
              type: object
              additionalProperties: true
        statusText:
          type: string
          description: Error message (detailed in debug mode)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````