Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented May 10, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a new endpoint for correcting hallucinations in generated text by comparing it with source documents. The response includes corrected text, a list of corrections, and explanations.
  • Improvements
    • Updated descriptions to clarify the capabilities of hallucination correction.
    • Renamed a property related to reranking for improved clarity and removed its experimental label.

@coderabbitai
Copy link

coderabbitai bot commented May 10, 2025

Walkthrough

The OpenAPI specification for the Vectara REST API v2 was updated to introduce a new POST endpoint for hallucination correction, including new request and response schemas. The hallucination corrector API group description was revised, and a property in the reranker schema was renamed and updated in its description.

Changes

File(s) Change Summary
src/libs/Vectara/openapi.yaml Added POST endpoint /v2/hallucination_correctors/correct_hallucinations with new request/response schemas; updated hallucination corrector group description; renamed and updated property in reranker schema.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant VectaraAPI

    Client->>VectaraAPI: POST /v2/hallucination_correctors/correct_hallucinations\n(HallucinationCorrectionRequest)
    VectaraAPI-->>Client: HallucinationCorrectionResponse
Loading

Poem

A new endpoint hops into view,
To fix hallucinations and make text true.
With schemas fresh and models bright,
Corrections leap from left to right.
A little rename, a tidy tweak—
The API grows strong each week!
🐇✨


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV merged commit 7bde349 into main May 10, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202505101241 branch May 10, 2025 12:42
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add hallucination correction endpoint and update reranker schema in OpenAPI May 10, 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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12f2e88 and 0e59e9e.

⛔ Files ignored due to path filters (16)
  • src/libs/Vectara/Generated/JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.CorrectHallucinations.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.IVectaraClient.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CorrectionItem.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CorrectionItem.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.CustomerSpecificReranker.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionRequest.Json.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.HallucinationCorrectionResponse.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionResponse.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.HcmSourceDocument.Json.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.Models.HcmSourceDocument.g.cs is excluded by !**/generated/**
  • src/libs/Vectara/Generated/Vectara.VectaraClient.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Vectara/openapi.yaml (4 hunks)
🔇 Additional comments (6)
src/libs/Vectara/openapi.yaml (6)

1907-1944: New hallucination correction endpoint added
The POST /v2/hallucination_correctors/correct_hallucinations endpoint is well-structured, with clear operationId, requestBody, and response definitions. This addition aligns with the PR objectives to introduce hallucination correction capabilities.


5407-5424: Define request schema for hallucination correction
The HallucinationCorrectionRequest schema correctly requires generated_text, documents, and model. The properties are strongly typed and documented.


5426-5434: Define source document schema
The HcmSourceDocument schema succinctly captures a single source document with required text. This is a clear and minimal design.


5453-5468: Define CorrectionItem schema
The CorrectionItem schema correctly captures individual correction entries with original_text, corrected_text, and explanation all marked as required. This aligns with the intended behavior.


5658-5692: Update Hallucination Correctors tag description
The tag description now accurately reflects both listing and correction operations for hallucination correctors. This provides clear guidance to API consumers.


3414-3417:

Details

✅ Verification successful

Rename reranker property to include_context
The schema property include_context replaces the old experimental flag correctly. Please verify that the deprecated experimental_use_text_with_context property has been fully removed from all schemas.


🏁 Script executed:

#!/bin/bash
# Verify no occurrences of the old experimental property remain
rg "experimental_use_text_with_context"

Length of output: 39


All occurrences of experimental_use_text_with_context removed

  • Ran rg "experimental_use_text_with_context" across the repository; no matches found.

Comment on lines +5435 to +5452
required:
- corrected_text
- corrections
type: object
properties:
corrections:
type: array
items:
$ref: '#/components/schemas/CorrectionItem'
description: 'A list of corrections applied to the text, with explanations.'
corrected_text:
type: string
description: 'The revised version of the text, with minimal edits made to correct unsupported or inaccurate statements. If no corrections are needed, this value is identical to the original text.'
model:
type: string
description: The name of the model used for hallucination correction.
description: The response that contains the hallucination correction results.
CorrectionItem:
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Make model required in response schema
The HallucinationCorrectionResponse properties include corrected_text, corrections, and model, but only the first two are marked required. According to the API design, the model field should also be required.

Apply this diff to include model in the required list:

 required:
-  - corrected_text
-  - corrections
+  - corrected_text
+  - corrections
+  - model
🤖 Prompt for AI Agents (early access)
In src/libs/Vectara/openapi.yaml around lines 5435 to 5452, the 'model' property
in the HallucinationCorrectionResponse schema is not marked as required. Update
the 'required' array to include 'model' along with 'corrected_text' and
'corrections' to ensure the schema correctly reflects that 'model' must be
present in the response.

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