DSPy
DSPy from Stanford NLP is a framework for programming language models.
DSPy introduces two key concepts, the programming model and optimizers.
Programing model: The programming model lets you define a series of components that make a language model request. Components include input fields, output fields, task descriptions, and calls to a vector database like Weaviate.
Optimizers: Optimizers compile your DSPy program to tune the language model prompt and/or the weights.
DSPy and Weaviate
Weaviate is integrated with DSPy through the retriever model!
Connect your Weaviate cluster (WCD or local instance) to DSPy, use the retriever module and pass in your collection:
weaviate_client = weaviate.Client("http://localhost:8080") # or pass in your WCD cluster url
retriever_module = WeaviateRM("WeaviateBlogChunk", # collection name
weaviate_client=weaviate_client)
Our Resources
Here are a few resources from the Weaviate team on using DSPy!
The resources are broken into two categories:
Hands on Learning: Build your technical understanding with end-to-end tutorials.
Read and Listen: Develop your conceptual understanding of these technologies.
Hands on Learning
Topic | Description | Resource |
---|---|---|
Getting Started with RAG in DSPy | Learn about DSPy and how to build a program: Installation, settings, datasets, LLM metrics, DSPy programming model, and optimization. | Notebook, Video |
DSPy + Weaviate for the Next Generation of LLM Apps | Build a 4-layer DSPy program for generating blog posts from queries. | Notebook, Video |
RAG with Persona | Build a compound AI system with DSPy, Cohere, and Weaviate, where you'll add a persona to the language model. | Notebook, Post |
Adding Depth to RAG Programs | Enhancing DSPy programs by integrating unique input-output examples and multiple LLMs. | Notebook, Video |
Hurricane: Writing Blog Posts with Generative Feedback Loops | Introduction to Hurricane, a web app for demonstrating generative feedback loops with blog posts. | Notebook, Blog |
Structured Outputs with DSPy | The three methods for structuring outputs in DSPy programs. | Notebook, Video |
Building RAG with Command R+ from Cohere, DSPy, and Weaviate | Overview of Command R+ with a quick RAG demo in DSPy. | Notebook, Video |
Advanced Optimizers in DSPy | Dive into optimizing DSPy programs with various techniques. | Notebook |
Llama 3 RAG Demo with DSPy Optimization, Ollama, and Weaviate | Integrating Llama3 with DSPy and optimizing prompts with MIPRO. | Notebook, Video |
BigQuery and Weaviate orchestrated with DSPy | Build an end-to-end RAG pipeline that uses BigQuery and Weaviate using DSPy. | Notebook |
Read and Listen
Topic | Description | Resource |
---|---|---|
DSPy and ColBERT with Omar Khattab! - Weaviate Podcast #85 | Omar Khattab joins the Weaviate podcast to discuss DSPy and ColBERT. | Video |
DSPy Explained | Learn about the core concepts of DSPy. Walk through the introduction notebooks to compile a simple retrieve-then-read RAG program and Multi-Hop RAG Program. | Video |
XMC.dspy with Karel D'Oosterlinck - Weaviate Podcast #87 | Karel D'Oosterlinck joins the Weaviate podcast to discuss IReRa (Infer-Retrieve-Rank). | Video |
Intro to DSPy: Goodbye Prompting, Hello Programming | Overview of DSPy and how it solves the fragility problem in LLM-based applications. | Blog |
Fine-Tuning Cohere’s Reranker | Generate synthetic data with DSPy to fine-tune Cohere’s reranker model. | Blog |
Your Language Model Deserves Better Prompting | Overview of the DSPy optimizers for prompt tuning. | Blog |
Questions and feedback
If you have any questions or feedback, let us know in the user forum.