-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Add /v2/hallucination_correctors GET endpoint and schema updates to OpenAPI #55
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
WalkthroughThe OpenAPI specification was updated to introduce a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant DB
Client->>API: GET /v2/hallucination_correctors?filter=...&limit=...&page_key=...
API->>DB: Query hallucination correctors (filter, pagination)
DB-->>API: Return list of correctors + metadata
API-->>Client: ListHallucinationCorrectorsResponse (correctors, metadata)
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 3
🧹 Nitpick comments (1)
src/libs/Vectara/openapi.yaml (1)
83-90: Consider pluralizing the parameter name for clarity.The new
corpus_idparameter accepts an array of IDs, but its singular name may be misleading. Consider renaming it tocorpus_idsto clearly indicate multiple values are allowed and align with REST naming conventions.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (26)
src/libs/Vectara/Generated/JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChat.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChatTurn.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.CorporaClient.ListCorpora.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.ListHallucinationCorrectors.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IChatsClient.CreateChat.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IChatsClient.CreateChatTurn.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.ICorporaClient.ListCorpora.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.ListHallucinationCorrectors.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.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.IVectaraClient.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.ChatRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CreateChatCompletionRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CustomerSpecificReranker.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrector.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrector.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.ListHallucinationCorrectorsResponse.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.ListHallucinationCorrectorsResponse.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.QueryCorpusRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.QueryRequest.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.VectaraClient.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Vectara/openapi.yaml(10 hunks)
🔇 Additional comments (7)
src/libs/Vectara/openapi.yaml (7)
380-383: Approve enhanced documentation forintelligent_query_rewriting.The description now clearly marks this feature as a Tech Preview and includes a link for more details.
3248-3250: Approve updatedintelligent_query_rewritingdescription inQueryRequest.The Tech Preview tag and documentation URL improve clarity for SDK users.
3289-3292: Approve updatedintelligent_query_rewritingdescription inQueryCorpusRequest.Consistent messaging across request schemas is beneficial.
3377-3380: Approve addition of experimentalexperimental_use_text_with_context.This flag is clearly documented as experimental, with a sensible default.
4261-4262: Approve updatedintelligent_query_rewritingdescription inChatRequest.The new description consistently marks this feature as a Tech Preview and provides a reference link.
5434-5435: Approve extended description forCreateChatCompletionRequest.The updated description clarifies OpenAI compatibility and customization options.
5590-5592: Approve addition ofHallucination Correctorstag.The new tag aligns with the added endpoint and provides clear grouping.
| /v2/hallucination_correctors: | ||
| get: | ||
| tags: | ||
| - Hallucination Correctors | ||
| summary: List hallucination correctors | ||
| description: 'Retrieves a list of available hallucination correctors used for detecting and correcting hallucinations in AI-generated content. This endpoint supports filtering by name or description, pagination, and metadata for navigating large result sets.' | ||
| operationId: listHallucinationCorrectors | ||
| parameters: | ||
| - $ref: '#/components/parameters/RequestTimeout' | ||
| - $ref: '#/components/parameters/RequestTimeoutMillis' | ||
| - name: filter | ||
| in: query | ||
| description: A regular expression applied to the name and description fields. Use this to return only hallucination correctors that match specific keywords or naming conventions. | ||
| schema: | ||
| type: string | ||
| - name: limit | ||
| in: query | ||
| description: The maximum number of hallucination correctors to return in the list. Defaults to 10. Range is between 1 and 100. | ||
| schema: | ||
| maximum: 100 | ||
| minimum: 1 | ||
| type: integer | ||
| format: int32 | ||
| default: 10 | ||
| - name: page_key | ||
| in: query | ||
| description: Retrieves the next page of hallucination correctors after reaching the limit. | ||
| schema: | ||
| type: string | ||
| responses: | ||
| '200': | ||
| description: List of hallucination correctors. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/ListHallucinationCorrectorsResponse' | ||
| '403': | ||
| description: Permissions do not allow listing hallucination correctors. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| x-fern-sdk-group-name: hallucination_correctors | ||
| x-fern-sdk-method-name: list | ||
| x-fern-pagination: | ||
| cursor: $request.page_key | ||
| next_cursor: $response.metadata.page_key | ||
| results: $response.hallucinationCorrectionModels |
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.
Fix pagination mapping property name.
The x-fern-pagination.results is currently pointing to $response.hallucinationCorrectionModels, but the response schema uses hallucination_correctors as the array property. This mismatch will break SDK generation.
Apply this diff to correct the mapping:
x-fern-pagination:
cursor: $request.page_key
next_cursor: $response.metadata.page_key
- results: $response.hallucinationCorrectionModels
+ results: $response.hallucination_correctors📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /v2/hallucination_correctors: | |
| get: | |
| tags: | |
| - Hallucination Correctors | |
| summary: List hallucination correctors | |
| description: 'Retrieves a list of available hallucination correctors used for detecting and correcting hallucinations in AI-generated content. This endpoint supports filtering by name or description, pagination, and metadata for navigating large result sets.' | |
| operationId: listHallucinationCorrectors | |
| parameters: | |
| - $ref: '#/components/parameters/RequestTimeout' | |
| - $ref: '#/components/parameters/RequestTimeoutMillis' | |
| - name: filter | |
| in: query | |
| description: A regular expression applied to the name and description fields. Use this to return only hallucination correctors that match specific keywords or naming conventions. | |
| schema: | |
| type: string | |
| - name: limit | |
| in: query | |
| description: The maximum number of hallucination correctors to return in the list. Defaults to 10. Range is between 1 and 100. | |
| schema: | |
| maximum: 100 | |
| minimum: 1 | |
| type: integer | |
| format: int32 | |
| default: 10 | |
| - name: page_key | |
| in: query | |
| description: Retrieves the next page of hallucination correctors after reaching the limit. | |
| schema: | |
| type: string | |
| responses: | |
| '200': | |
| description: List of hallucination correctors. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/ListHallucinationCorrectorsResponse' | |
| '403': | |
| description: Permissions do not allow listing hallucination correctors. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| x-fern-sdk-group-name: hallucination_correctors | |
| x-fern-sdk-method-name: list | |
| x-fern-pagination: | |
| cursor: $request.page_key | |
| next_cursor: $response.metadata.page_key | |
| results: $response.hallucinationCorrectionModels | |
| /v2/hallucination_correctors: | |
| get: | |
| tags: | |
| - Hallucination Correctors | |
| summary: List hallucination correctors | |
| description: 'Retrieves a list of available hallucination correctors used for detecting and correcting hallucinations in AI-generated content. This endpoint supports filtering by name or description, pagination, and metadata for navigating large result sets.' | |
| operationId: listHallucinationCorrectors | |
| parameters: | |
| - $ref: '#/components/parameters/RequestTimeout' | |
| - $ref: '#/components/parameters/RequestTimeoutMillis' | |
| - name: filter | |
| in: query | |
| description: A regular expression applied to the name and description fields. Use this to return only hallucination correctors that match specific keywords or naming conventions. | |
| schema: | |
| type: string | |
| - name: limit | |
| in: query | |
| description: The maximum number of hallucination correctors to return in the list. Defaults to 10. Range is between 1 and 100. | |
| schema: | |
| maximum: 100 | |
| minimum: 1 | |
| type: integer | |
| format: int32 | |
| default: 10 | |
| - name: page_key | |
| in: query | |
| description: Retrieves the next page of hallucination correctors after reaching the limit. | |
| schema: | |
| type: string | |
| responses: | |
| '200': | |
| description: List of hallucination correctors. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/ListHallucinationCorrectorsResponse' | |
| '403': | |
| description: Permissions do not allow listing hallucination correctors. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| x-fern-sdk-group-name: hallucination_correctors | |
| x-fern-sdk-method-name: list | |
| x-fern-pagination: | |
| cursor: $request.page_key | |
| next_cursor: $response.metadata.page_key | |
| results: $response.hallucination_correctors |
🤖 Prompt for AI Agents (early access)
In src/libs/Vectara/openapi.yaml between lines 1859 and 1906, the pagination
mapping property name in the x-fern-pagination extension is incorrect. The
results field is currently set to $response.hallucinationCorrectionModels, but
the response schema uses hallucination_correctors as the array property. To fix
this, update the x-fern-pagination.results value to
$response.hallucination_correctors to match the response schema and ensure
correct SDK generation.
| type: object | ||
| properties: | ||
| id: | ||
| pattern: 'hcm_[0-9]+$' | ||
| type: string | ||
| description: The unique ID for the Hallucination Corrector (HC). | ||
| example: hcm_123 | ||
| name: | ||
| type: string | ||
| description: 'The hallucination corrector name, typically including the base name and variant.' | ||
| example: qwen2.5-7b-instruct-hcm | ||
| type: | ||
| type: string | ||
| description: The hallucination corrector type. Defaults to `vectara`. | ||
| default: vectara | ||
| description: | ||
| type: string | ||
| description: A short description of the hallucination corrector’s purpose. | ||
| example: Qwen/Qwen2.5-7B-Instruct for hallucination correction in AI-generated text. | ||
| enabled: | ||
| type: boolean | ||
| description: Indicates whether the hallucination corrector is enabled and available for use in hallucination correction workflows. | ||
| example: true | ||
| description: A hallucination corrector that detects and corrects hallucinations in generated text. | ||
| ListHallucinationCorrectorsResponse: |
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.
Add missing required fields to the HallucinationCorrector schema.
Without a required list, validation may not enforce necessary properties.
HallucinationCorrector:
type: object
+ required:
+ - id
+ - name
+ - type
+ - enabled
properties:
id:
pattern: 'hcm_[0-9]+$'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| type: object | |
| properties: | |
| id: | |
| pattern: 'hcm_[0-9]+$' | |
| type: string | |
| description: The unique ID for the Hallucination Corrector (HC). | |
| example: hcm_123 | |
| name: | |
| type: string | |
| description: 'The hallucination corrector name, typically including the base name and variant.' | |
| example: qwen2.5-7b-instruct-hcm | |
| type: | |
| type: string | |
| description: The hallucination corrector type. Defaults to `vectara`. | |
| default: vectara | |
| description: | |
| type: string | |
| description: A short description of the hallucination corrector’s purpose. | |
| example: Qwen/Qwen2.5-7B-Instruct for hallucination correction in AI-generated text. | |
| enabled: | |
| type: boolean | |
| description: Indicates whether the hallucination corrector is enabled and available for use in hallucination correction workflows. | |
| example: true | |
| description: A hallucination corrector that detects and corrects hallucinations in generated text. | |
| ListHallucinationCorrectorsResponse: | |
| HallucinationCorrector: | |
| type: object | |
| required: | |
| - id | |
| - name | |
| - type | |
| - enabled | |
| properties: | |
| id: | |
| pattern: 'hcm_[0-9]+$' | |
| type: string | |
| description: The unique ID for the Hallucination Corrector (HC). | |
| example: hcm_123 | |
| name: | |
| type: string | |
| description: 'The hallucination corrector name, typically including the base name and variant.' | |
| example: qwen2.5-7b-instruct-hcm | |
| type: | |
| type: string | |
| description: The hallucination corrector type. Defaults to `vectara`. | |
| default: vectara | |
| description: | |
| type: string | |
| description: A short description of the hallucination corrector’s purpose. | |
| example: Qwen/Qwen2.5-7B-Instruct for hallucination correction in AI-generated text. | |
| enabled: | |
| type: boolean | |
| description: Indicates whether the hallucination corrector is enabled and available for use in hallucination correction workflows. | |
| example: true | |
| description: A hallucination corrector that detects and corrects hallucinations in generated text. |
🤖 Prompt for AI Agents (early access)
In src/libs/Vectara/openapi.yaml around lines 4759 to 4783, the
HallucinationCorrector schema lacks a `required` field list, which means
validation won't enforce the presence of essential properties. Add a `required`
array specifying the mandatory properties such as `id`, `name`, `type`, and
`enabled` to ensure these fields must be present in any valid object of this
schema.
| type: object | ||
| properties: | ||
| hallucination_correctors: | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/HallucinationCorrector' | ||
| description: An array of hallucination correctors that match the request parameters. | ||
| metadata: | ||
| $ref: '#/components/schemas/ListMetadata' | ||
| description: Response containing a list of hallucination correctors. | ||
| Job: |
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.
🛠️ Refactor suggestion
Declare required fields in ListHallucinationCorrectorsResponse.
Ensuring hallucination_correctors and metadata are required improves schema correctness.
ListHallucinationCorrectorsResponse:
type: object
+ required:
+ - hallucination_correctors
+ - metadata
properties:
hallucination_correctors:
type: array📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| type: object | |
| properties: | |
| hallucination_correctors: | |
| type: array | |
| items: | |
| $ref: '#/components/schemas/HallucinationCorrector' | |
| description: An array of hallucination correctors that match the request parameters. | |
| metadata: | |
| $ref: '#/components/schemas/ListMetadata' | |
| description: Response containing a list of hallucination correctors. | |
| Job: | |
| ListHallucinationCorrectorsResponse: | |
| type: object | |
| required: | |
| - hallucination_correctors | |
| - metadata | |
| properties: | |
| hallucination_correctors: | |
| type: array | |
| items: | |
| $ref: '#/components/schemas/HallucinationCorrector' | |
| description: An array of hallucination correctors that match the request parameters. | |
| metadata: | |
| $ref: '#/components/schemas/ListMetadata' | |
| description: Response containing a list of hallucination correctors. |
🤖 Prompt for AI Agents (early access)
In src/libs/Vectara/openapi.yaml around lines 4784 to 4794, the
ListHallucinationCorrectorsResponse schema lacks a required field declaration
for hallucination_correctors and metadata. Add a required section listing these
two properties to ensure they are mandatory in the response schema, improving
schema correctness and validation.
Summary by CodeRabbit