You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -484,16 +484,18 @@ Connect to any LLM provider:
484
484
# Ollama (local, free)
485
485
/connect ollama llama3.1:8b
486
486
487
-
# OpenAI
488
-
/connect openai gpt-4
487
+
# OpenAI (example small model)
488
+
/connect openai gpt-5-nano
489
489
490
-
# Anthropic
490
+
# Anthropic (paid key required)
491
491
/connect anthropic claude-3-5-sonnet-20241022
492
492
493
-
# Google Gemini
494
-
/connect gemini gemini-2.0-flash-exp
493
+
# Google Gemini (example model)
494
+
/connect gemini gemini-2.5-flash
495
495
```
496
496
497
+
> 💡 **Tip:** These are just starting points. Check your provider docs for the **latest models** (for example gpt-4o / gpt‑5 family, Gemini 2.5, latest Claude Sonnet/Opus) and plug them into `/connect`.
498
+
497
499
## 🧬 GEPA Optimization
498
500
499
501
DSPy Code includes real GEPA (Genetic Pareto) optimization:
@@ -640,7 +642,7 @@ DSPy Code is currently in **Beta** and under active development. While it's func
640
642
641
643
<divalign="center">
642
644
643
-
Built with ❤️ by **[Superagentic AI](https://super-agentic.ai)**
645
+
Brought to you by **[Superagentic AI](https://super-agentic.ai)**
644
646
645
647
Special thanks to the DSPy community and all contributors!
646
648
@@ -668,6 +670,6 @@ It helps others discover the project and motivates us to keep improving it.
GEPA optimization can make **a large number of LLM calls**. If you're connected to a cloud provider (OpenAI, Anthropic, Gemini), be sure you understand the potential API cost and have your quotas/billing configured before running `/optimize`.
# If you use uv, you can install dspy-code like this
69
+
uv pip install --upgrade dspy-code
70
+
```
73
71
74
-
# Install in development mode
75
-
pip install -e .
76
-
```
72
+
That's it! DSPy Code is now installed in your project.
77
73
78
-
##Install DSPy
74
+
### Step 4: Install DSPy (Optional)
79
75
80
-
DSPy Code requires DSPy to be installed. If you don't have it yet:
76
+
DSPy Code will install DSPy automatically if needed, but you can install/upgrade it explicitly:
81
77
82
-
```bash
83
-
pip install dspy
84
-
```
78
+
=== "pip"
85
79
86
-
!!! info "DSPy Version"
87
-
DSPy Code works with any DSPy version (2.x, 3.x, or newer). It adapts to YOUR installed version!
80
+
```bash
81
+
pip install --upgrade dspy
82
+
```
88
83
89
-
### Step 4: Install DSPy (Optional)
84
+
=== "uv"
90
85
91
-
DSPy Code works with any version of DSPy you have installed:
92
-
93
-
```bash
94
-
pip install dspy
95
-
```
86
+
```bash
87
+
uv pip install --upgrade dspy
88
+
```
96
89
97
90
!!! info "DSPy Version"
98
-
DSPy Code adapts to YOUR installed DSPy version! It indexes your specific version for accurate code generation and Q&A.
91
+
DSPy Code adapts to YOUR installed DSPy version and indexes it for accurate code generation and Q&A.
99
92
100
93
## Verify Installation
101
94
@@ -156,27 +149,47 @@ my-dspy-project/
156
149
157
150
## Optional Dependencies
158
151
159
-
DSPy Code has optional dependencies for different features. Install only what you need:
152
+
DSPy Code has optional dependencies for different features. Install only what you need.
160
153
161
-
### For OpenAI Models
154
+
### Cloud Model Providers (via dspy-code extras)
162
155
163
-
```bash
164
-
pip install openai
165
-
```
156
+
Use extras so versions stay aligned with dspy-code’s tested matrix.
166
157
167
-
### For Anthropic Claude
158
+
=== "pip"
168
159
169
-
```bash
170
-
pip install anthropic
171
-
```
160
+
```bash
161
+
# OpenAI support
162
+
pip install "dspy-code[openai]"
172
163
173
-
### For Google Gemini
164
+
# Google Gemini support
165
+
pip install "dspy-code[gemini]"
174
166
175
-
```bash
176
-
pip install google-generativeai
177
-
```
167
+
# Anthropic (paid key required)
168
+
pip install "dspy-code[anthropic]"
169
+
170
+
# Or install all cloud providers at once
171
+
pip install "dspy-code[llm-all]"
172
+
```
173
+
174
+
=== "uv"
175
+
176
+
```bash
177
+
# OpenAI support
178
+
uv pip install "dspy-code[openai]"
179
+
180
+
# Google Gemini support
181
+
uv pip install "dspy-code[gemini]"
182
+
183
+
# Anthropic (paid key required)
184
+
uv pip install "dspy-code[anthropic]"
185
+
186
+
# Or install all cloud providers at once
187
+
uv pip install "dspy-code[llm-all]"
188
+
```
189
+
190
+
> **Note:** Anthropic has discontinued free API keys. DSPy Code fully supports Claude **if you already have a paid API key**, but Anthropic integration will simply not work without one.
Copy file name to clipboardExpand all lines: docs/getting-started/quick-start.md
+74-32Lines changed: 74 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,47 @@
2
2
3
3
Get started with DSPy Code in 5 minutes! This guide will walk you through creating your first DSPy program.
4
4
5
-
## Prerequisites
5
+
## Prerequisites (One‑Time Setup)
6
6
7
-
Before starting, make sure you have:
7
+
You only need to do this once for each new DSPy project.
8
8
9
-
1.**Created your project directory**
10
-
2.**Set up virtual environment INSIDE the project**
11
-
3.**Installed dspy-code**
9
+
```bash
10
+
# 1. Create a project directory
11
+
mkdir my-dspy-project
12
+
cd my-dspy-project
13
+
14
+
# 2. Create a virtual environment INSIDE this directory
15
+
python -m venv .venv
16
+
17
+
# 3. Activate the virtual environment
18
+
# For bash/zsh (macOS/Linux):
19
+
source .venv/bin/activate
20
+
# For fish:
21
+
source .venv/bin/activate.fish
22
+
# On Windows:
23
+
.venv\Scripts\activate
24
+
25
+
# 4. Install dspy-code (always upgrade for latest features)
26
+
pip install --upgrade dspy-code
12
27
13
-
If you haven't done this yet, see [Installation Guide](installation.md).
28
+
# 5. (Optional but recommended) Install provider SDKs via dspy-code extras
29
+
30
+
# If you ONLY want local models (Ollama), you can skip this step.
31
+
32
+
# OpenAI support
33
+
pip install "dspy-code[openai]"
34
+
35
+
# Google Gemini support
36
+
pip install "dspy-code[gemini]"
37
+
38
+
# Anthropic (paid key required)
39
+
pip install "dspy-code[anthropic]"
40
+
41
+
# Or install all cloud providers at once
42
+
pip install "dspy-code[llm-all]"
43
+
```
44
+
45
+
For more details, see the [Installation Guide](installation.md).
14
46
15
47
## Step 1: Navigate to Your Project
16
48
@@ -56,7 +88,30 @@ You'll see a beautiful welcome screen with the DSPy version and helpful tips.
56
88
💬 Or just describe what you want to build!
57
89
```
58
90
59
-
## Step 2: Initialize Your Project
91
+
## Step 3: Connect a Model (Required)
92
+
93
+
Before you do anything else in the CLI, you **must connect to a model**. DSPy Code relies on an LLM for code generation and understanding.
94
+
95
+
```bash
96
+
# Ollama (local, free)
97
+
/connect ollama llama3.1:8b
98
+
99
+
# Or OpenAI (example small model)
100
+
/connect openai gpt-5-nano
101
+
102
+
# Or Google Gemini (example model)
103
+
/connect gemini gemini-2.5-flash
104
+
```
105
+
106
+
> 💡 **Tip:** These are just starting points. Use the latest models your account supports (for example gpt‑4o / gpt‑5 family, Gemini 2.5, latest Claude Sonnet/Opus) for best quality.
107
+
108
+
!!! warning "Cloud Cost & Optimization"
109
+
- When you're connected to **cloud providers** (OpenAI, Anthropic, Gemini), remember that API usage is **billed per token**.
110
+
- GEPA **optimization** (via `/optimize` or generated optimization scripts) can make a *lot* of LLM calls. Only run optimization if you understand the potential cost and have quotas/billing configured.
111
+
- For local optimization runs with larger models, we recommend at least **32 GB RAM**.
112
+
- For more details, see [Model Connection (Cloud & Local)](../guide/model-connection.md) and the [Optimization Guide](../guide/optimization.md).
113
+
114
+
## Step 4: Initialize Your Project
60
115
61
116
Inside the CLI, type:
62
117
@@ -73,7 +128,7 @@ This will:
73
128
!!! tip "What's Happening?"
74
129
The `/init` command scans your installed DSPy version and your project code. This lets DSPy Code answer questions about DSPy and understand your project!
75
130
76
-
## Step 3: Generate Your First Program
131
+
## Step 5: Generate Your First Program
77
132
78
133
Now for the fun part! Just describe what you want in plain English:
79
134
@@ -106,7 +161,7 @@ DSPy Code will:
106
161
return self.predictor(text=text)
107
162
```
108
163
109
-
## Step 4: Save Your Code
164
+
## Step 6: Save Your Code
110
165
111
166
Save the generated code to a file:
112
167
@@ -121,7 +176,7 @@ The file will be saved to your `generated/` directory.
121
176
✓ Code saved to: generated/sentiment.py
122
177
```
123
178
124
-
## Step 5: Validate Your Code
179
+
## Step 7: Validate Your Code
125
180
126
181
Check if your code follows DSPy best practices:
127
182
@@ -139,7 +194,7 @@ DSPy Code will check for:
139
194
!!! tip "Quality Checks"
140
195
The validator catches common mistakes and suggests improvements. It's like having an expert review your code!
141
196
142
-
## Step 6: Run Your Program
197
+
## Step 8: Run Your Program
143
198
144
199
Test your program:
145
200
@@ -154,30 +209,17 @@ DSPy Code will execute your code in a safe sandbox and show you the results.
154
209
You just:
155
210
156
211
1. ✅ Started DSPy Code
157
-
2. ✅ Initialized a project
158
-
3. ✅ Generated a DSPy program
159
-
4. ✅ Saved it to a file
160
-
5. ✅ Validated the code
161
-
6. ✅ Ran it successfully
212
+
2. ✅ Connected a model
213
+
3. ✅ Initialized a project
214
+
4. ✅ Generated a DSPy program
215
+
5. ✅ Saved it to a file
216
+
6. ✅ Validated the code
217
+
7. ✅ Ran it successfully
162
218
163
219
## What's Next?
164
220
165
-
### Connect a Model (Optional but Recommended)
166
-
167
-
For better code generation, connect to an LLM:
168
-
169
-
```
170
-
/connect ollama llama3.1:8b
171
-
```
172
-
173
-
Or use OpenAI:
174
-
175
-
```
176
-
/connect openai gpt-4
177
-
```
178
-
179
-
!!! info "Why Connect a Model?"
180
-
Without a model, DSPy Code uses templates. With a model, it can understand your specific requirements and generate more customized code!
221
+
!!! info "Why Model Connection is Required"
222
+
DSPy Code needs an LLM to understand your requests and generate DSPy code. Without a connected model, most interactive features will not work.
- **Cloud models (OpenAI, Anthropic, Gemini)**: GEPA can trigger **many LLM calls**. Only run optimization if you understand the potential API cost and have billing/quotas configured appropriately.
350
+
- **Local runs**: For smooth optimization on local hardware, we recommend at least **32 GB RAM**, especially with larger models.
351
+
- Start with small budgets and fewer examples when experimenting.
352
+
348
353
### Optimization Process
349
354
350
355
**1. Prepare Data:**
@@ -411,22 +416,24 @@ This feedback helps GEPA learn!
411
416
/connect ollama llama3.1:8b
412
417
```
413
418
414
-
**2. OpenAI:**
419
+
**2. OpenAI (modern SDK, example small model):**
415
420
416
421
```
417
-
/connect openai gpt-4
422
+
/connect openai gpt-5-nano
418
423
```
419
424
420
-
**3. Anthropic:**
425
+
**3. Anthropic (paid only, optional):**
421
426
422
427
```
423
-
/connect anthropic claude-3-sonnet
428
+
/connect anthropic claude-sonnet-4.5
424
429
```
425
430
426
-
**4. Gemini:**
431
+
> Anthropic no longer offers free API keys. If you have a paid key, DSPy Code will work with Claude; otherwise, just skip Anthropic and use another provider.
0 commit comments