Skip to content

Updated LlamaIndex chatbot sample - #69

Open
Allen Kim (allenkim0129) wants to merge 3 commits into
microsoft:mainfrom
allenkim0129:main
Open

Updated LlamaIndex chatbot sample#69
Allen Kim (allenkim0129) wants to merge 3 commits into
microsoft:mainfrom
allenkim0129:main

Conversation

@allenkim0129

Copy link
Copy Markdown

Description

Updated LlamaIndex-CosmosDBNoSql-RAG-Chatbot-Sample.ipynb to align with the new search capabilities introduced in run-llama/llama_index#20871, which adds 7 search types and a fully parameterised query engine to llama-index-vector-stores-azurecosmosnosql.

Changes

Notebook format

  • Converted from a Jupyter #%%-style Python script to a proper .ipynb file with separate, individually-runnable code and markdown cells.

Credentials

  • Replaced bare os.getenv(...) calls with explicit "YOUR_AZURE_..." placeholder fallbacks so the notebook is self-documenting and works out of the box without a .env file.

Dependencies (Section 1)

  • Added explicit %pip install cells for llama-index-vector-stores-azurecosmosnosql, gradio, and python-dotenv.

Full Text Search store (Section 6)

  • Added a dedicated fts_store container configured with full_text_policy and fullTextIndexes in the indexing policy, required for full text and hybrid search types.

Search types showcase (Section 7)

Demonstrated all 7 search types via direct store.query() / fts_store.query() calls using AzureCosmosDBNoSqlVectorSearchType:

SectionSearch TypeKey detail
7aVECTORDefault nearest-neighbour, ordered by VectorDistance
7bVECTOR_SCORE_THRESHOLDAdds threshold kwarg to filter low-similarity results
7cFULL_TEXT_SEARCHFullTextContains WHERE — no query_embedding passed
7dFULL_TEXT_RANKINGORDER BY RANK FullTextScore(...) — single-field and multi-field (RRF) examples; no query_embedding passed
7eHYBRIDORDER BY RANK RRF(FullTextScore, VectorDistance)
7fHYBRID_SCORE_THRESHOLDHybrid RRF + client-side threshold filter
7gWEIGHTED_HYBRID_SEARCHHybrid RRF + weights list for per-component client-side re-ranking

Advanced query options showcase (Section 8)

Added individual cells demonstrating each new query kwarg:

SectionKwargDescription
8awhereRaw CosmosDB SQL WHERE predicate for pre-filtering
8boffset_limitOFFSET x LIMIT y pagination (replaces TOP for hybrid types)
8cprojection_mappingMap Cosmos DB document fields to LlamaIndex node metadata keys
8dreturn_with_vectorsInclude raw embedding vectors in returned nodes

Gradio chatbot (Section 9)

  • Moved to the final section; wired to the default index.as_query_engine() (vector search).
  • Improved label copy and elapsed-time formatting.

Type of Change

  • Documentation / sample update (non-breaking)

Related

Testing

Run the notebook top-to-bottom against a live Azure Cosmos DB for NoSQL account with:

  • Vector search preview feature enabled
  • Full text search preview feature enabled (required for Sections 6, 7c–7g, 8b)

@allenkim0129
Allen Kim (allenkim0129) marked this pull request as ready for review March 6, 2026 21:09
Sign up for freeto 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.

1 participant

@allenkim0129