-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Refactor LLM schemas, add OpenAI/Vertex variants and auth, mime_type #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughRefactors 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches🧪 Generate unit tests
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. Comment |
There was a problem hiding this 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/pngAlso 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/pngAlso 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_diagramAlso 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-20250219Option 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.
⛔ Files ignored due to path filters (72)
src/libs/Vectara/Generated/Vectara..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.CorporaClient.UpdateCorpus.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.DocumentsClient.SummarizeCorpusDocument.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.GenerationPresetsClient.ListGenerationPresets.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.ICorporaClient.UpdateCorpus.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IDocumentsClient.SummarizeCorpusDocument.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IGenerationPresetsClient.ListGenerationPresets.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.CorrectHallucinations.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IQueriesClient.Query.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IQueriesClient.QueryCorpus.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IQueriesClient.SearchCorpus.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IUploadClient.UploadFile.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.JsonConverters.CreateLLMRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.JsonConverters.CreateOpenAILLMRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.JsonConverters.CreateOpenAIResponsesLLMRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.JsonConverters.VertexAiAuth.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.JsonConverters.VertexAiAuthDiscriminatorType.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.JsonConverters.VertexAiAuthDiscriminatorTypeNullable.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.BearerAuth.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.ComputeCorpusSizeResponse.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.Corpus.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CorpusLimits.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateLLMRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateLLMRequestDiscriminatorType.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequest.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequestVariant2.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAILLMRequestVariant2.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequest.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequestVariant2.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateOpenAIResponsesLLMRequestVariant2.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequest.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequestTestModelParameters.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateVertexAILLMRequestTestModelParameters.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.EvaluateFactualConsistencyRequestModelParameters.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.EvaluateFactualConsistencyResponse.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.GenerationParameters.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.GenerationPreset.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrector.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HeaderAuth.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.Job.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.LLM.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBase.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBase.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseHeaders.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseHeaders.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseTestModelParameters.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.OpenAILLMRequestBaseTestModelParameters.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.QueryFullResponse.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.QueryHistory.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.QueryHistorySummary.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.SummarizeDocumentRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.SummarizeDocumentResponse.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.UpdateCorpusRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiApiKeyAuth.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiApiKeyAuth.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiAuth.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiAuth.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiAuthDiscriminator.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiAuthDiscriminator.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiAuthDiscriminatorType.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiServiceAccountAuth.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.VertexAiServiceAccountAuth.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.QueriesClient.Query.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.QueriesClient.QueryCorpus.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.QueriesClient.SearchCorpus.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.UploadClient.UploadFile.g.csis 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?
Summary by CodeRabbit
New Features
Refactor
Documentation
Bug Fixes