Skip to content

Instantly share code, notes, and snippets.

View dennyglee's full-sized avatar

Denny Lee dennyglee

View GitHub Profile
@dennyglee
dennyglee / rag-testing-llama-index-indexes.md
Last active September 6, 2025 13:16
RAG testing with different indexes via llama-index

RAG testing using different indexes with llamaindex

Different Indexes result in different answers

(Generated by Chat GPT 4.0)

Retrieval-Augmented Generation (RAG) systems, which combine a neural network-based generative model with a retrieval system, can use various types of indexes to retrieve relevant documents or passages. The type of index used can significantly impact the performance and output of the RAG system. Let's explore why using different indexes like Keyword Table Index, Vector Store Index, Summary Index, Tree Index, and Knowledge Graph Index for the same document results in different answers:

  1. Keyword Table Index:
  • Nature: It's based on keyword matching.
@dennyglee
dennyglee / query-dbrx-via-FMAPI-using-OpenAI-SDK.py
Last active March 31, 2024 20:11
Locally Query DBRX using Foundation Model API (FMAPI) using OpenAI Python SDK
#
# Locally Query DBRX using Foundation Model API (FMAPI) using OpenAI Python SDK
#
#
import json
import os
from openai import OpenAI
@dennyglee
dennyglee / query-dbrx-via-FMAPI-using-OpenAI-SDK.json
Last active March 31, 2024 20:07
query-dbrx-via-FMAPI-using-OpenAI-SDK Results
{
"id": "9755cef0-b958-47ec-b696-1aeb6f9674f6",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Well, my dear, if I had a dollar for every time I've been asked this question, I'd be sipping a pi\u00f1a colada on my private yacht instead of standing behind this stove. But since you've asked, and I can see that little glimmer of curiosity in your eyes, I'll indulge you.\n\nNow, let's get one thing straight: I'm not going to tell you that one is better than the other. That would be like comparing a Picasso to a Monet - they're both masterpieces, but they appeal to different tastes. It's all about personal preference, you see.\n\nMontreal bagels, bless their hearts, are these petite, crispy, and slightly sweet beauties. They're boiled in honey-sweetened water and then baked in a wood-fired oven, which gives them this delightful, smoky flavor. They're a bit denser than their New York count
@dennyglee
dennyglee / using-dbrx-with-pyspark-ai.md
Created April 1, 2024 15:30
Using DBRX with PySpark AI

Using DBRX with PySpark AI

This markdown shows a quick example of how to use Databricks DBRX to generate and run a transform query against a sammple dataset.

Requirements

Install the following

  • Configure and install databricks-cli
  • pip install langchain langchain-community mlflow setuptools
@dennyglee
dennyglee / llama-index_starter_dbrx.py
Last active April 10, 2024 07:25
Llama_Index Starter Example using DBRX
#
# LlamaIndex Starter Example with DBRX
#
# Based on the LlamaIndex Starter Example
# https://docs.llamaindex.ai/en/stable/getting_started/starter_example/
#
# Ensure you have installed both llama_index and Databricks integration
# e.g., pip install llama_index llama-index-llms-databricks
#