---
updatedAt: 2026-09-09T18:01:58.000Z
agentTools:
  projectIndex: https://developer.vyasa.com/llms.txt
---

# Generate an assistant response, including any tool calls selected by the model

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Layar API Documentation",
    "version": "4.1.4",
    "contact": {
      "name": "Certara AI Support",
      "email": "AI-Support@Certara.com",
      "url": "https://vyasa.readme.io/"
    }
  },
  "servers": [
    {
      "url": "BASE_PATH"
    }
  ],
  "paths": {
    "/v2/gpt/generate": {
      "post": {
        "operationId": "generateV2",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GptGenerateCommandV2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptGenerateResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Generate an assistant response, including any tool calls selected by the model",
        "tags": [
          "gpt"
        ]
      }
    }
  },
  "tags": [
    {
      "description": "GPT",
      "name": "gpt"
    }
  ],
  "components": {
    "schemas": {
      "GptGenerateResponseV2": {
        "title": "GptGenerateResponseV2",
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "reasoningContent": {
            "type": "string"
          },
          "finishReason": {
            "type": "string"
          },
          "assistantTurn": {
            "type": "string",
            "description": "Opaque assistant-provider state to include unchanged in the next assistant history message."
          },
          "toolCalls": {
            "type": "array",
            "description": "Tools selected by the assistant for the caller to execute.",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "arguments"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "arguments": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "sourcesUsed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "documentsUsed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                }
              }
            }
          },
          "chunksUsed": {
            "type": "array",
            "description": "Retrieved chunks. Fields listed in getMetadata are returned as additional top-level properties on each item.",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "documentId": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "chunkId": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "paragraphId": {
                  "type": "string"
                },
                "score": {
                  "type": "string"
                },
                "expandedText": {
                  "type": "string"
                },
                "expandedScore": {
                  "type": "string"
                },
                "rerankScore": {
                  "type": "number",
                  "format": "float"
                },
                "vectorScoreContribution": {
                  "type": "number",
                  "format": "float"
                },
                "keywordScoreContribution": {
                  "type": "number",
                  "format": "float"
                },
                "embedder": {
                  "type": "string",
                  "description": "Embedder model name used for this chunk"
                },
                "snippetId": {
                  "type": "string",
                  "description": "Snippet identifier for citation-level source tracking"
                }
              }
            }
          },
          "perplexity": {
            "type": "number",
            "format": "float"
          }
        }
      },
      "GptGenerateCommandV2": {
        "title": "GptGenerateCommandV2",
        "type": "object",
        "description": "V2 GPT Generate Command.\n\nKey differences from V1:\n- conversationId is required (was optional)\n- Uses documentProcessingMethod enum (\"raw\", \"rag\", \"truncate\") instead of ragSkipEnabled boolean\n- Removed deprecated conversation and summarize fields\n- Removed task field from messageHistory items\n",
        "required": [
          "conversationId"
        ],
        "properties": {
          "content": {
            "type": "string",
            "description": "The prompt/question to send to the LLM. Optional when messageHistory ends with a tool result."
          },
          "conversationId": {
            "type": "string",
            "description": "Required unique identifier for the conversation. Generate a UUID if not tracking conversations."
          },
          "messageHistory": {
            "type": "array",
            "description": "Previous messages in the conversation",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant",
                    "system",
                    "tool"
                  ],
                  "description": "The type of message"
                },
                "content": {
                  "type": "string",
                  "description": "The message content"
                },
                "assistantTurn": {
                  "type": "string",
                  "description": "Opaque assistant-provider state. Supply only on assistant messages and preserve the returned value unchanged."
                },
                "toolCalls": {
                  "type": "array",
                  "description": "Tools selected by an assistant message.",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "name",
                      "arguments"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "arguments": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                },
                "toolCallId": {
                  "type": "string",
                  "description": "For a tool message, the assistant tool-call ID this result answers."
                }
              }
            }
          },
          "sources": {
            "type": "array",
            "description": "Source documents for context",
            "items": {
              "type": "object",
              "properties": {
                "docs": {
                  "type": "object",
                  "description": "Distributed source document search command for finding documents across the data fabric"
                },
                "provider": {
                  "type": "string",
                  "description": "[Deprecated] Data provider name. Use docs.dataProviders instead."
                },
                "documentId": {
                  "type": "string",
                  "description": "[Deprecated] Document ID. Use docs.ids instead."
                },
                "savedListId": {
                  "type": "string",
                  "description": "[Deprecated] Saved list ID. Use docs.savedListIds instead."
                },
                "rawText": {
                  "type": "string",
                  "description": "Raw text to include as context"
                },
                "url": {
                  "type": "string",
                  "description": "URL to fetch and use as context"
                },
                "chunkId": {
                  "type": "string",
                  "description": "Specific chunk ID within a document"
                },
                "documentType": {
                  "type": "string",
                  "enum": [
                    "DOCUMENT",
                    "TABLE",
                    "IMAGE"
                  ],
                  "description": "Type of document"
                }
              }
            }
          },
          "model": {
            "type": "string",
            "description": "The LLM model to use"
          },
          "documentProcessingMethod": {
            "type": "string",
            "enum": [
              "raw",
              "rag",
              "truncate"
            ],
            "description": "Method for processing documents. Replaces ragSkipEnabled boolean.\n- rag: Use RAG (default). Documents are chunked and retrieved based on relevance.\n- raw: Process documents without RAG. Fails if sources exceed context window.\n- truncate: Truncate documents that exceed the context window.\n",
            "default": "rag"
          },
          "maxTokens": {
            "type": "integer",
            "description": "Maximum tokens in the response"
          },
          "temperature": {
            "type": "number",
            "format": "float",
            "description": "Temperature for response generation (0.0 to 2.0)"
          },
          "topK": {
            "type": "integer",
            "description": "Top-k sampling parameter"
          },
          "topP": {
            "type": "number",
            "format": "float",
            "description": "Top-p (nucleus) sampling parameter"
          },
          "frequencyPenalty": {
            "type": "number",
            "format": "float",
            "description": "Frequency penalty for token generation"
          },
          "llmSeed": {
            "type": "integer",
            "description": "Seed for reproducible LLM outputs"
          },
          "logprobs": {
            "type": "integer",
            "description": "Number of log probabilities to return"
          },
          "stream": {
            "type": "boolean",
            "description": "Enable streaming response"
          },
          "transientData": {
            "type": "boolean",
            "description": "If true, data will not be persisted",
            "default": false
          },
          "documentContentMode": {
            "type": "string",
            "enum": [
              "text",
              "multimodal_pages"
            ],
            "description": "Controls how document sources are sent to the model.\n- text: Preserve the current text-only document path.\n- multimodal_pages: Send an image of each page of PDF and DOCX documents to a multimodal (vision) model. Requires documentProcessingMethod raw or truncate.\n",
            "default": "text"
          },
          "embedder": {
            "type": "string",
            "description": "The embedder to use for vector generation"
          },
          "generateCitations": {
            "type": "boolean",
            "description": "Generate citations in the response"
          },
          "ragQuery": {
            "type": "string",
            "description": "Custom query for RAG retrieval (overrides content)"
          },
          "retriever": {
            "type": "object",
            "description": "RAG retriever configuration",
            "properties": {
              "document": {
                "type": "object",
                "properties": {
                  "indexName": {
                    "type": "string"
                  },
                  "lookupFilter": {
                    "type": "string"
                  },
                  "reranker": {
                    "type": "boolean"
                  },
                  "rerankerMultiplier": {
                    "type": "integer"
                  },
                  "mmrReranker": {
                    "type": "boolean"
                  },
                  "mmrLambdaMulti": {
                    "type": "number",
                    "format": "float"
                  },
                  "numHits": {
                    "type": "integer"
                  },
                  "heatRatio": {
                    "type": "number",
                    "format": "float"
                  },
                  "enableSectioning": {
                    "type": "boolean",
                    "default": true
                  },
                  "searchRatio": {
                    "type": "number",
                    "format": "float"
                  },
                  "relevanceThreshold": {
                    "type": "number",
                    "format": "float"
                  }
                }
              },
              "table": {
                "type": "object",
                "properties": {
                  "indexName": {
                    "type": "string"
                  },
                  "lookupFilter": {
                    "type": "string"
                  },
                  "reranker": {
                    "type": "boolean"
                  },
                  "rerankerMultiplier": {
                    "type": "integer"
                  },
                  "mmrReranker": {
                    "type": "boolean"
                  },
                  "mmrLambdaMulti": {
                    "type": "number",
                    "format": "float"
                  },
                  "numHits": {
                    "type": "integer"
                  },
                  "heatRatio": {
                    "type": "number",
                    "format": "float"
                  },
                  "enableSectioning": {
                    "type": "boolean",
                    "default": false
                  },
                  "searchRatio": {
                    "type": "number",
                    "format": "float"
                  },
                  "relevanceThreshold": {
                    "type": "number",
                    "format": "float"
                  }
                }
              }
            }
          },
          "prompts": {
            "type": "object",
            "description": "Custom prompts for generation",
            "properties": {
              "system": {
                "type": "string",
                "description": "System prompt"
              },
              "summarization": {
                "type": "string",
                "description": "Summarization prompt"
              },
              "combine": {
                "type": "string",
                "description": "Combine prompt"
              }
            }
          },
          "searchOperator": {
            "type": "string",
            "enum": [
              "AND",
              "OR"
            ],
            "description": "Logical operator to combine search conditions",
            "default": "AND"
          },
          "getMetadata": {
            "type": "array",
            "description": "Metadata field names to request from certara-gpt (get_metadata). Returned as top-level properties on each item in chunksUsed.",
            "items": {
              "type": "string"
            },
            "example": [
              "section",
              "codes"
            ]
          },
          "searchFilters": {
            "type": "array",
            "description": "Filters to apply to RAG search",
            "items": {
              "type": "object",
              "properties": {
                "documentId": {
                  "type": "string"
                },
                "documentType": {
                  "type": "string",
                  "enum": [
                    "DOCUMENT",
                    "TABLE"
                  ]
                },
                "searchConditions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string"
                      },
                      "operator": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "tools": {
            "type": "array",
            "description": "Tools the model may choose to invoke. Tool execution remains the caller's responsibility.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "description",
                "inputSchema"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "inputSchema": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "JSON Schema describing the tool arguments."
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "oAuth2ClientCredentials": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "CONNECT_API_URL/oauth/token",
            "scopes": {}
          }
        }
      }
    }
  },
  "security": [
    {
      "oAuth2ClientCredentials": []
    }
  ]
}
```