Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Sep 6, 2025

Summary by CodeRabbit

  • New Features

    • Added multi-provider LLM support: OpenAI-compatible, OpenAI Responses API, and Vertex AI Gemini.
    • Introduced Vertex AI authentication via API key and service account.
  • Refactor

    • Streamlined LLM creation request options with clearer provider-specific fields.
  • Documentation

    • Expanded, realistic examples across corpora, LLMs, generation presets, queries, jobs, and auth.
    • Switched context highlighting examples to use tags.
    • Sample requests now show intelligent_query_rewriting set to false.
  • Bug Fixes

    • Image objects now include a top-level mime_type field in examples.

@coderabbitai
Copy link

coderabbitai bot commented Sep 6, 2025

Walkthrough

Refactors LLM creation schemas to introduce a base for OpenAI-compatible requests, adds OpenAI Responses and Vertex AI Gemini variants with discriminators, and defines Vertex AI auth types. Updates multiple public schemas with examples, adds Image.mime_type, adjusts context highlighting tags to em, and tweaks sample payload defaults.

Changes

Cohort / File(s) Summary
LLM provider expansion and request refactor
src/libs/Vectara/openapi.yaml
Added OpenAILLMRequestBase; refactored CreateOpenAILLMRequest via allOf; introduced CreateOpenAIResponsesLLMRequest and CreateVertexAILLMRequest; expanded CreateLLMRequest oneOf and discriminator mappings.
Vertex AI authentication schemas
src/libs/Vectara/openapi.yaml
Added VertexAiApiKeyAuth, VertexAiServiceAccountAuth, and VertexAiAuth with discriminator mappings for api_key and service_account.
Schema examples and documentation tweaks
src/libs/Vectara/openapi.yaml
Added/updated examples across Corpus, LLM, GenerationPreset, QueryFullResponse, QueryHistory, Job, GenerationParameters, BearerAuth, HeaderAuth; minor description clarifications.
Image/Document schema refinement
src/libs/Vectara/openapi.yaml
Added top-level Image.mime_type (examples updated); Document image examples updated accordingly; ImageData.mime_type retained.
Context highlighting adjustments
src/libs/Vectara/openapi.yaml
Switched highlighting tags in examples/config from start_tag/end_tag using to .
Sample defaults for query rewriting
src/libs/Vectara/openapi.yaml
Set intelligent_query_rewriting to false in several request/streamed response examples.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant API as Vectara API
  participant Router as LLM Router
  participant OpenAI as OpenAI-Compatible
  participant OAIResp as OpenAI Responses
  participant Vertex as Vertex AI (Gemini)

  Note over API,Router: Create LLM flow (discriminator-driven)

  Client->>API: POST /llms (CreateLLMRequest)
  API->>Router: Validate payload, resolve discriminator type
  alt type == openai-compatible
    Router->>OpenAI: Create with base fields + provider model
    OpenAI-->>Router: LLM created
  else type == openai-responses
    Router->>OAIResp: Create via Responses API
    OAIResp-->>Router: LLM created
  else type == vertex-ai
    Router->>Vertex: Create with auth (api_key or service_account)
    Vertex-->>Router: LLM created
  end
  Router-->>API: Normalized LLM record
  API-->>Client: 201 Created (LLM)

  Note over Router: Auth selection for Vertex AI via VertexAiAuth discriminator
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my paws—new models hop in line,
OpenAI, Vertex, routes all intertwine.
Tags shift to , highlights softly gleam,
Images mime_type sing in the schema stream.
With keys or service accounts we roam—
A rabbit maps providers, forging home. 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202509060144

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HavenDV HavenDV merged commit bf14a38 into main Sep 6, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202509060144 branch September 6, 2025 01:44
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Refactor LLM schemas, add OpenAI/Vertex variants and auth, mime_type Sep 6, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/libs/Vectara/openapi.yaml (3)

5058-5084: Fix schema mismatch between ImageMetadata and Document.images (required lists an undefined property).

ImageMetadata marks image_data as required but does not define it; Document.images references ImageMetadata yet examples include image_data. This breaks validation and confuses consumers.

Apply:

--- a/src/libs/Vectara/openapi.yaml
+++ b/src/libs/Vectara/openapi.yaml
@@
-    ImageMetadata:
-      required:
-        - id
-        - image_data
-        - mime_type
+    ImageMetadata:
+      required:
+        - id
+        - mime_type
@@
       properties:
@@
-        mime_type:
+        mime_type:
           type: string
           description: 'The MIME type of the image, indicating the format of the binary data (e.g., image/jpeg for JPEG images).'
           example: image/jpeg
@@
-        images:
+        images:
           type: array
           items:
             $ref: '#/components/schemas/ImageMetadata'
           description: The images that this document contains.
@@
-        images:
-          - id: image_1
-            title: Quarterly Sales Performance
-            caption: Sales growth trends for Q1 to Q4 of 2024
-            description: 'A bar chart showing quarterly sales growth, with Q4 outperforming all previous quarters by 15%'
-            mime_type: image/png
-            image_data:
-              data: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4//8/AAX+Av4N70a4AAAAAElFTkSuQmCC
+        images:
+          - id: image_1
+            title: Quarterly Sales Performance
+            caption: Sales growth trends for Q1 to Q4 of 2024
+            description: 'A bar chart showing quarterly sales growth, with Q4 outperforming all previous quarters by 15%'
+            mime_type: image/png

Also applies to: 5153-5160, 5196-5203


5240-5264: Add top-level mime_type to Image and reflect it in the example.

The summary claims Image gained top-level mime_type, but the schema lacks it; example also omits it.

@@
     Image:
       required:
         - id
         - image_data
       type: object
       properties:
         id:
@@
         image_data:
           $ref: '#/components/schemas/ImageData'
+        mime_type:
+          type: string
+          description: 'The MIME type of the image (duplicated here for convenience in addition to image_data.mime_type).'
+          example: image/png
@@
       description: 'An image element within a document, containing its identifying information, optional metadata, and the actual image data.'
@@
-              example:
+              example:
                 id: image_1
                 title: Quarterly Sales Performance
                 caption: Sales growth trends for Q1 to Q4 of 2024
                 description: 'A bar chart showing quarterly sales growth, with Q4 outperforming all previous quarters by 15%'
+                mime_type: image/png
                 image_data:
                   data: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4//8/AAX+Av4N70a4AAAAAElFTkSuQmCC
                   mime_type: image/png

Also applies to: 1356-1370


2914-2935: Align Chat turn examples to use metadata_filter (snake_case).

Examples use metadataFilter (camelCase) which doesn’t exist in the schema; should be metadata_filter.

-                    metadataFilter: doc.clause_type = 'non_compete'
+                    metadata_filter: doc.clause_type = 'non_compete'
@@
-                    metadataFilter: doc.type = 'tax_policy'
+                    metadata_filter: doc.type = 'tax_policy'
@@
-                    metadataFilter: doc.platform = 'web_portal' AND doc.error_code = '403'
+                    metadata_filter: doc.platform = 'web_portal' AND doc.error_code = '403'
🧹 Nitpick comments (7)
src/libs/Vectara/openapi.yaml (7)

6148-6149: Remove stray apostrophe in generation_preset_name description.

Trailing quote breaks some OpenAPI toolchains.

-          description: "The preset values to use to feed the query results and other context to the model.  \n\nA `generation_preset` is an object with a bundle of properties that specifies: \n* The `prompt_template` that is rendered and then sent to the LLM. \n* The LLM used. * `model_parameter`s such as temperature.\n\nAll of these properties except the model can be overridden by setting them in this object. Even when a `prompt_template` is set, the `generation_preset_name` is used to set the model used. See `model_parameters.model` if you want to set the model explicitly.\n\nIf `generation_preset_name` is not set, the Vectara platform will use the default model and prompt.'\n"
+          description: "The preset values to use to feed the query results and other context to the model.  \n\nA `generation_preset` is an object with a bundle of properties that specifies: \n* The `prompt_template` that is rendered and then sent to the LLM. \n* The LLM used. * `model_parameter`s such as temperature.\n\nAll of these properties except the model can be overridden by setting them in this object. Even when a `prompt_template` is set, the `generation_preset_name` is used to set the model used. See `model_parameters.model` if you want to set the model explicitly.\n\nIf `generation_preset_name` is not set, the Vectara platform will use the default model and prompt.\n"

4977-4986: Fix broken quotes in UploadFileRequest examples.

Malformed keys will trip example validators.

-        metadata:
-          department": engineering
-          doc_type": architecture_diagram
+        metadata:
+          department: engineering
+          doc_type: architecture_diagram
-          example:
-            department: engineering
-            doc_type": architecture_diagram
+          example:
+            department: engineering
+            doc_type: architecture_diagram

Also applies to: 4961-4963


3311-3313: Correct copy: “listing summarizers” → “listing LLMs”.

Matches the operation purpose.

-        '403':
-          description: Permissions do not allow listing summarizers.
+        '403':
+          description: Permissions do not allow listing LLMs.

7017-7021: Avoid implying Anthropic is OpenAI-compatible; fix URI example.

Use an OpenAI endpoint for OpenAI-compatible examples and avoid misleading provider list.

-        uri:
+        uri:
           type: string
-          description: The URI endpoint for the API (can be OpenAI or any compatible API endpoint)
+          description: The URI endpoint for the API (OpenAI or an OpenAI-compatible proxy)
           format: uri
-          example: https://api.anthropic.com/v1/chat/completions
+          example: https://api.openai.com/v1/chat/completions
@@
-              description: 'Must be "openai-compatible" for OpenAI and OpenAI-compatible APIs (like Anthropic Claude, Azure OpenAI, etc)'
+              description: 'Must be "openai-compatible" for OpenAI and OpenAI-compatible providers (e.g., Azure OpenAI).'

Also applies to: 7045-7047


6951-6978: Tweak placeholder secret examples to avoid secret scanners.

Gitleaks flagged generic API keys. Use unmistakable placeholders.

-          example: abcdef......
+          example: <REDACTED-TOKEN>
@@
-          example: sk-ant.....
+          example: sk_example_xxxxxxxxxxxxxxxxxxxxxx

6353-6358: Consider setting a reasonable maxItems for corpora array.

Addresses CKV_OPENAPI_21 and protects server from oversized payloads.

         corpora:
-          minItems: 1
+          minItems: 1
+          maxItems: 50
           type: array

6995-7051: Deduplicate model property between base and derived LLM requests or clarify precedence.

model exists in OpenAILLMRequestBase and again in derived schemas; this can confuse codegen. Prefer only in derived, or keep in base and remove from derived required list.

Option A (preferred): remove model from base.

-        model:
-          type: string
-          description: 'The model name to use with the API (e.g. gpt-4, claude-2, etc). This is used in the API request to the remote LLM provider.'
-          example: claude-3-7-sonnet-20250219

Option B: keep in base and drop duplicate property blocks in derived, keeping only “required: [type]” there.

Also applies to: 7156-7170

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fdd5cc5 and d9d8413.

⛔ Files ignored due to path filters (72)
  • src/libs/Vectara/Generated/Vectara..JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.CorporaClient.UpdateCorpus.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.DocumentsClient.SummarizeCorpusDocument.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.GenerationPresetsClient.ListGenerationPresets.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.ICorporaClient.UpdateCorpus.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IDocumentsClient.SummarizeCorpusDocument.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IGenerationPresetsClient.ListGenerationPresets.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.CorrectHallucinations.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IQueriesClient.Query.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IQueriesClient.QueryCorpus.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IQueriesClient.SearchCorpus.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IUploadClient.UploadFile.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.JsonConverters.CreateLLMRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.JsonConverters.CreateOpenAILLMRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.JsonConverters.CreateOpenAIResponsesLLMRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.JsonConverters.VertexAiAuth.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.JsonConverters.VertexAiAuthDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.JsonConverters.VertexAiAuthDiscriminatorTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.BearerAuth.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.ComputeCorpusSizeResponse.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.Corpus.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CorpusLimits.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateLLMRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateLLMRequestDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequest.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequestVariant2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequestVariant2.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequest.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequestVariant2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequestVariant2.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequest.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequestTestModelParameters.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequestTestModelParameters.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.EvaluateFactualConsistencyRequestModelParameters.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.EvaluateFactualConsistencyResponse.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.GenerationParameters.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.GenerationPreset.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrector.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.HeaderAuth.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.Job.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.LLM.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBase.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBase.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseHeaders.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseHeaders.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseTestModelParameters.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseTestModelParameters.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.QueryFullResponse.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.QueryHistory.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.QueryHistorySummary.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.SummarizeDocumentRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.SummarizeDocumentResponse.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.UpdateCorpusRequest.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiApiKeyAuth.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiApiKeyAuth.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiAuth.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiAuth.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiAuthDiscriminator.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiAuthDiscriminator.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiAuthDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiServiceAccountAuth.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.VertexAiServiceAccountAuth.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.QueriesClient.Query.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.QueriesClient.QueryCorpus.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.QueriesClient.SearchCorpus.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.UploadClient.UploadFile.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Vectara/openapi.yaml (52 hunks)
🧰 Additional context used
🪛 Checkov (3.2.334)
src/libs/Vectara/openapi.yaml

[MEDIUM] 293-298: Ensure that arrays have a maximum number of items

(CKV_OPENAPI_21)

🪛 Gitleaks (8.27.2)
src/libs/Vectara/openapi.yaml

317-317: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (1)
src/libs/Vectara/openapi.yaml (1)

844-872: Clarify multipart field “filename” usage.

OpenAPI typically relies on file.filename from the part; a separate text field often confuses clients. Either document why it’s needed or mark as optional with clear client hints.

Would you like me to align this to RFC 7578-style filename usage in the file part and remove the extra field?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants