Skip to content

Conversation

@VirajAgarwal1
Copy link
Contributor

No description provided.

…ase and OpenAI

- Changed tutorial path and titles to reflect the use of Couchbase Search Vector Index instead of FTS.
- Updated descriptions to clarify the integration of Couchbase's vector search capabilities with OpenAI embeddings.
- Removed the fts_index.json file as it is no longer needed.
- Enhanced the RAG notebook to include updated content and examples using the new index types.
- Adjusted tags in frontmatter to align with the new terminology.
@VirajAgarwal1 VirajAgarwal1 self-assigned this Nov 17, 2025
@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Caution

Notebooks or Frontmatter Files Have Been Modified

  • Please ensure that a frontmatter.md file is accompanying the notebook file, and that the frontmatter is up to date.
  • These changes will be published to the developer portal tutorials only if frontmatter.md is included.
  • Proofread all changes before merging, as changes to notebook and frontmatter content will update the developer tutorial.

3 Notebook Files Modified:

Notebook File Frontmatter Included?
haystack/fts/RAG_with_Couchbase_Capella_and_OpenAI.ipynb
haystack/query_based/RAG_with_Couchbase_Capella_and_OpenAI.ipynb
haystack/search_based/RAG_with_Couchbase_Capella_and_OpenAI.ipynb

4 Frontmatter Files Modified:

Frontmatter File
haystack/fts/frontmatter.md
haystack/gsi/frontmatter.md
haystack/query_based/frontmatter.md
haystack/search_based/frontmatter.md
Note: frontmatter will be checked and tested in the Test Frontmatter workflow.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @VirajAgarwal1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the Couchbase Haystack demo to be compatible with Haystack 8.0. It removes the old FTS-based demo and introduces a new demo leveraging query-based vector search, providing an up-to-date example of integrating Couchbase with Haystack for RAG applications.

Highlights

  • Demo Update: This PR updates the Haystack demo to align with the 8.0 release, migrating from FTS-based vector search to query-based vector search.
  • Notebook Removal: Removes the old FTS-based RAG demo notebook (haystack/fts/RAG_with_Couchbase_Capella_and_OpenAI.ipynb) and its associated frontmatter.
  • Notebook Addition: Adds a new query-based RAG demo notebook (haystack/query_based/RAG_with_Couchbase_Capella_and_OpenAI.ipynb) and its frontmatter, showcasing the updated Haystack 8.0 integration.
  • Requirements Update: Renames haystack/fts/requirements.txt to haystack/query_based/requirements.txt to reflect the new notebook location.
  • Index Definition Update: Renames haystack/fts/fts_index.json to haystack/search_based/search_vector_index.json.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly refactors the Haystack demos to align with Couchbase 8.0 features, replacing the former fts and gsi based examples with new search_based and query_based notebooks. This is a great update that clarifies the technology being demonstrated.

My review of the new notebooks has uncovered a few issues, including some critical and high-severity bugs that would prevent the demos from running correctly. These include an issue with dynamic index creation in the search_based notebook, the use of unsafe eval() when processing data, and incorrect index parameters in the query_based notebook that lead to a failure during index creation. I've also noted some minor inconsistencies in markdown and comments that could be improved for clarity. Addressing these points will greatly improve the quality and user experience of these new demos.

" \n",
" options = {\n",
" \"dimension\": 3072, # text-embedding-3-large dimension\n",
" \"description\": \"IVF1024,PQ32x8\",\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The Hyperscale index creation is configured with "IVF1024,PQ32x8", which requires at least 1024 documents for training. However, the notebook only indexes 100 documents, causing the index creation to fail as shown in the cell's output. To make the demo runnable, please change the configuration to use auto-selected centroids (e.g., "IVF,PQ32x8") or increase the number of indexed documents to be more than 1024.

        "description": "IVF,PQ32x8",

Comment on lines 471 to 474
" with open('search_vector_index.json', 'r') as search_file:\n",
" search_index_definition = SearchIndex.from_json(json.load(search_file))\n",
" scope_search_manager.upsert_index(search_index_definition)\n",
" print(f\"Search Vector Index '{search_index_name}' created successfully at scope level.\")"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

There is a bug in the index creation logic within the except block. The code re-reads the original search_vector_index.json file, which discards the dynamic updates (e.g., index name, scope, collection) applied earlier. This will result in either an incorrect index being created or a failure. The code should use the search_index_definition object that has already been modified.

        scope_search_manager.upsert_index(search_index_definition)
        print(f"Search Vector Index '{search_index_name}' created successfully at scope level.")

" try:\n",
" docs_data.append({\n",
" 'id': str(row[\"id\"]),\n",
" 'content': f\"Title: {row['title']}\\nGenres: {', '.join([genre['name'] for genre in eval(row['genres'])])}\\nOverview: {row['overview']}\",\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using eval() on data from an external source is a security vulnerability as it can execute arbitrary code. It's much safer to use ast.literal_eval() to parse literal structures from strings. Please also add import ast at the beginning of this cell.

            'content': f"Title: {row['title']}\nGenres: {', '.join([genre['name'] for genre in ast.literal_eval(row['genres'])])}\nOverview: {row['overview']}",

" news_dataset = load_dataset('RealTimeData/bbc_news_alltime', '2024-12', split=\"train\")\n",
" print(f\"Loaded the BBC News dataset with {len(news_dataset)} rows\")\n",
"except Exception as e:\n",
" raise ValueError(f\"Error loading TREC dataset: {str(e)}\")"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The error message in the except block is misleading. It refers to the "TREC dataset", but the code is attempting to load the "bbc_news_alltime" dataset. This should be corrected to avoid confusion.

    raise ValueError(f"Error loading BBC News dataset: {str(e)}")

"source": [
"# Run Indexing Pipeline\n",
"\n",
"Execute the pipeline for processing and indexing BCC news documents:"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The markdown description for the indexing pipeline mentions using a DocumentSplitter as the first step. However, the pipeline defined in the next cell does not include a DocumentSplitter. This discrepancy should be corrected to avoid confusing users.

- Cleared all output cells to ensure a clean notebook state.
- Set execution counts to null for all code cells to allow for fresh execution.
- Adjusted the indexing pipeline to process a larger number of documents (from 100 to 1200).
- Updated the sample query to reflect current news context.
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