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

# Optimize prompt via chat

> Optimize a scene query prompt through an interactive chat with Gemini



## OpenAPI

````yaml https://api2.rhombussystems.com/api/openapi/public.json post /api/scenequery/optimizePromptChat
openapi: 3.0.1
info:
  contact:
    email: developer@rhombussystems.com
  description: >-
    This API is for use by Rhombus customers and partners.


    ## Authentication


    All requests require two headers:

    - `x-auth-scheme` — The authentication scheme identifier. Use `api-token`
    for standard API key auth, or `partner-api-token` for partner API auth.

    - `x-auth-apikey` — Your Rhombus API key.


    Example:

    ```

    POST /api/camera/getMinimalCameraStateList

    x-auth-scheme: api-token

    x-auth-apikey: YOUR_API_KEY

    Content-Type: application/json

    ```
  title: Rhombus API
  version: '1.0'
servers:
  - description: Production Server
    url: https://api2.rhombussystems.com
security:
  - ApiKeyAuth: []
paths:
  /api/scenequery/optimizePromptChat:
    post:
      tags:
        - Scene Query Webservice
      summary: Optimize prompt via chat
      description: Optimize a scene query prompt through an interactive chat with Gemini
      operationId: optimizePromptChat
      parameters:
        - description: >-
            Authentication scheme identifier. Use `api-token` for standard API
            key authentication, `partner-api-token` for partner API key
            authentication. Must be paired with the `x-auth-apikey` header
            containing your API key.
          example: api-token
          in: header
          name: x-auth-scheme
          required: true
          schema:
            type: string
            default: api-token
            enum:
              - api-token
              - api
              - partner-api-token
              - partner-api
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Scenequery_PromptOptimizationChatWSRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Scenequery_PromptOptimizationChatWSResponse
          description: OK
components:
  schemas:
    Scenequery_PromptOptimizationChatWSRequest:
      type: object
      description: Request object for prompt optimization chat.
      properties:
        context:
          $ref: '#/components/schemas/Scenequery_OptimizationContextType'
        currentMessage:
          type: string
          description: Current user message
          nullable: true
        history:
          type: array
          description: Chat history messages
          items:
            $ref: '#/components/schemas/Scenequery_ChatMessageType'
          nullable: true
    Scenequery_PromptOptimizationChatWSResponse:
      type: object
      description: Response object for prompt optimization chat.
      properties:
        error:
          type: boolean
          nullable: true
        errorMsg:
          type: string
          nullable: true
        explanation:
          type: string
          description: Explanation of the optimization
          nullable: true
        optimizedPrompt:
          type: string
          description: The optimized prompt
          nullable: true
        questionForUser:
          type: string
          description: Follow-up question for the user, if any
          nullable: true
        warningMsg:
          type: string
          nullable: true
    Scenequery_OptimizationContextType:
      type: object
      description: >-
        Context for prompt optimization including the camera frame, original
        prompt, and expected answer.
      properties:
        deviceFacetUuid:
          type: string
          format: DeviceFacetUuid
          description: RUUID with optional appended facet information
          example: AAAAAAAAAAAAAAAAAAAAAA.v0
          nullable: true
        expectedAnswer:
          type: string
          description: Expected answer the prompt should produce
          nullable: true
        optionalContext:
          type: string
          description: Optional additional context for the optimization
          nullable: true
        originalAnswer:
          type: string
          description: >-
            Original answer produced by the LLM (must be a boolean, number, or
            percentage)
          nullable: true
        originalPrompt:
          type: string
          description: Original prompt that was used
          nullable: true
        region:
          $ref: '#/components/schemas/Scenequery_RegionPolygonType'
        timestampMs:
          type: integer
          format: int64
          description: Timestamp in milliseconds for the camera frame to use
          nullable: true
    Scenequery_ChatMessageType:
      type: object
      description: A single chat message with a role and text content.
      properties:
        role:
          type: string
          description: Role of the message sender (user or model)
          nullable: true
        text:
          type: string
          description: Text content of the message
          nullable: true
    Scenequery_RegionPolygonType:
      type: object
      description: Optional region polygon to crop the camera frame
      properties:
        coordinates:
          type: array
          items:
            $ref: '#/components/schemas/Scenequery_RegionCoordinateType'
          nullable: true
    Scenequery_RegionCoordinateType:
      type: object
      properties:
        x:
          type: number
          format: float
          nullable: true
        'y':
          type: number
          format: float
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      description: >-
        Your Rhombus API key. Must be accompanied by the `x-auth-scheme` header
        set to `api-token` (or `partner-api-token` for partner endpoints).
      in: header
      name: x-auth-apikey
      type: apiKey

````