Skip to content

Conversation

@lpozo
Copy link
Contributor

@lpozo lpozo commented Nov 6, 2025

Where to put new files:

  • New files should go into a top-level subfolder, named after the article slug. For example: my-awesome-article

How to merge your changes:

  1. Make sure the CI code style tests all pass (+ run the automatic code formatter if necessary).
  2. Find an RP Team member on Slack and ask them to review & approve your PR.
  3. Once the PR has one positive ("approved") review, GitHub lets you merge the PR.
  4. 🎉

Copy link
Contributor

@martin-martin martin-martin left a comment

Choose a reason for hiding this comment

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

Tried it out, thanks for the updates, all is working for me (except I'm still timing out with Ollama ¯_(ツ)_/¯). Also asking Copilot for a review, but IMO we're good to go.

Copilot finished reviewing on behalf of martin-martin November 27, 2025 10:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds sample code for a Real Python tutorial on LlamaIndex, a framework for building RAG (Retrieval-Augmented Generation) applications. The code demonstrates various ways to use LlamaIndex with different LLM providers (OpenAI, Google, Ollama) and indexing strategies.

Key Changes

  • Sample Python scripts demonstrating LlamaIndex usage with synchronous and asynchronous queries
  • Examples showing different index types (Vector, Summary, Tree)
  • Integration examples with multiple LLM providers (OpenAI, Google Gemini, Ollama)

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
python-llamaindex/single_query.py Basic example showing single query execution with index persistence
python-llamaindex/async_query.py Demonstrates asynchronous query execution for multiple queries
python-llamaindex/indices.py Compares different index types (Vector, Summary, Tree)
python-llamaindex/documents.py Simple document loading example
python-llamaindex/demo.py Minimal demo showing basic LlamaIndex workflow
python-llamaindex/demo_ollama.py Integration example with Ollama local LLM
python-llamaindex/demo_gpt5.py OpenAI integration example (contains nonexistent model)
python-llamaindex/demo_google.py Google Gemini integration example (contains nonexistent model)
python-llamaindex/requirements.txt Python dependencies for all examples
python-llamaindex/README.md Brief documentation linking to the tutorial
python-llamaindex/data/pep8.rst Sample data file (PEP 8 style guide) for indexing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

DATA_FILE = BASE_DIR / "data" / "pep8.rst"


def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The function get_index lacks a docstring. Consider adding documentation that explains its purpose, parameters, and return value. For example:

def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
    """Load or create a VectorStoreIndex.
    
    Args:
        persist_dir: Directory where the index is persisted. Defaults to PERSIST_DIR.
        data_file: Path to the data file to index. Defaults to DATA_FILE.
    
    Returns:
        VectorStoreIndex: The loaded or newly created index.
    """
Suggested change
def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
"""Load or create a VectorStoreIndex.
Args:
persist_dir: Directory where the index is persisted. Defaults to PERSIST_DIR.
data_file: Path to the data file to index. Defaults to DATA_FILE.
Returns:
VectorStoreIndex: The loaded or newly created index.
"""

Copilot uses AI. Check for mistakes.
DATA_FILE = BASE_DIR / "data" / "pep8.rst"


def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The function get_index lacks a docstring. Consider adding documentation that explains its purpose, parameters, and return value. For example:

def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
    """Load or create a VectorStoreIndex.
    
    Args:
        persist_dir: Directory where the index is persisted. Defaults to PERSIST_DIR.
        data_file: Path to the data file to index. Defaults to DATA_FILE.
    
    Returns:
        VectorStoreIndex: The loaded or newly created index.
    """
Suggested change
def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
def get_index(persist_dir=PERSIST_DIR, data_file=DATA_FILE):
"""
Load or create a VectorStoreIndex.
Args:
persist_dir (Path): Directory where the index is persisted. Defaults to PERSIST_DIR.
data_file (Path): Path to the data file to index. Defaults to DATA_FILE.
Returns:
VectorStoreIndex: The loaded or newly created index.
"""

Copilot uses AI. Check for mistakes.
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.

3 participants