DSPy: The framework for programming—not prompting—language models
Python
2
Omar Khattab9a1617c2917f
diff --git a/docs/building-blocks/1-signatures.md b/docs/building-blocks/1-signatures.mdindex 3b00e46a6..28333b306 100644--- a/docs/building-blocks/1-signatures.md+++ b/docs/building-blocks/1-signatures.md@@ -2,7 +2,7 @@sidebar_position: 2----# 1️⃣ Signatures+# Signatures## What is a DSPy Signature?diff --git a/docs/building-blocks/2-modules.md b/docs/building-blocks/2-modules.mdindex 8f45f15fe..89de2edc8 100644--- a/docs/building-blocks/2-modules.md+++ b/docs/building-blocks/2-modules.md@@ -2,41 +2,5 @@sidebar_position: 3----# 2️⃣ Modules+# Modules--## What is a DSPy Module?--A **DSPy module** is a building block for programs that use LMs.--- Each built-in module abstracts a **prompting technique** (like chain of thought or ReAct). Crucially, they are generalized to handle any [DSPy Signature]().--- A DSPy module has **learnable parameters** (i.e., the little pieces comprising the prompt and the LM weights) and can be invoked (called) to process inputs and return outputs.--- Multiple modules can be composed into bigger modules (programs). DSPy modules are inspired directly by NN modules in PyTorch, but applied to LM programs.---### How do I use a built-in module, like `dspy.Predict` or `dspy.ChainOfThought`?--Let's start with the most fundamental module, `dspy.Predict`. Internally, all other DSPy modules are just built using `dspy.Predict`.--We'll assume you are already at least a little familiar with [DSPy signatures], which are declarative specs for defining the behavior of any module we use in DSPy.--To use a module, we first **declare** it by giving it a signature. Then we **call** the module with the input arguments, and extract the output fields!--```python-sentence = "it's a charming and often affecting journey." # example from the SST-2 dataset.--# 1) Declare with a signature.-classify = dspy.Predict('sentence -> sentiment')--# 2) Call with input argument(s).-response = classify(sentence=sentence)--# 3) Access the output.-print(response.sentiment)-```-**Output:**-```text-Positive-```