DSPy: The framework for programming—not prompting—language models
Python
2
Omar Khattab3b40d0bc52f9
diff --git a/docs/building-blocks/2-modules.md b/docs/building-blocks/2-modules.mdindex c06615d83..72e33fafb 100644--- a/docs/building-blocks/2-modules.md+++ b/docs/building-blocks/2-modules.md@@ -2,7 +2,7 @@sidebar_position: 3----# Modules+# ModulesA **DSPy module** is a building block for programs that use LMs.@@ -11,29 +11,3 @@ A **DSPy module** is a building block for programs that use LMs.- 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-```