Skip to content

Commit 326125f

Browse files
committed
Enhance the cloud model connectin and natural language
1 parent 7026fb2 commit 326125f

24 files changed

+393
-256
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -484,16 +484,18 @@ Connect to any LLM provider:
484484
# Ollama (local, free)
485485
/connect ollama llama3.1:8b
486486

487-
# OpenAI
488-
/connect openai gpt-4
487+
# OpenAI (example small model)
488+
/connect openai gpt-5-nano
489489

490-
# Anthropic
490+
# Anthropic (paid key required)
491491
/connect anthropic claude-3-5-sonnet-20241022
492492

493-
# Google Gemini
494-
/connect gemini gemini-2.0-flash-exp
493+
# Google Gemini (example model)
494+
/connect gemini gemini-2.5-flash
495495
```
496496

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+
497499
## 🧬 GEPA Optimization
498500

499501
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
640642

641643
<div align="center">
642644

643-
Built with ❤️ by **[Superagentic AI](https://super-agentic.ai)**
645+
Brought to you by **[Superagentic AI](https://super-agentic.ai)**
644646

645647
Special thanks to the DSPy community and all contributors!
646648

@@ -668,6 +670,6 @@ It helps others discover the project and motivates us to keep improving it.
668670

669671
<img src="https://raw.githubusercontent.com/SuperagenticAI/dspy-code/main/docs/resource/dspy-code.png" alt="DSPy Code" width="100"/>
670672

671-
**Made with 💜 for the DSPy community**
673+
**Made for the DSPy community**
672674

673675
</div>

docs/getting-started/first-program.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class FeedbackClassifierModule(dspy.Module):
120120
# Configure DSPy
121121
import dspy
122122
dspy.settings.configure(
123-
lm=dspy.OpenAI(model="gpt-3.5-turbo")
123+
lm=dspy.OpenAI(model="gpt-5-nano")
124124
)
125125

126126
# Create and use the classifier
@@ -259,6 +259,9 @@ Generate GEPA optimization code:
259259
/optimize
260260
```
261261

262+
!!! warning "Optimization on Cloud Models"
263+
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`.
264+
262265
This creates a complete GEPA optimization script!
263266

264267
**What's included:**

docs/getting-started/installation.md

Lines changed: 56 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -55,47 +55,40 @@ source .venv/bin/activate.fish
5555

5656
### Step 3: Install DSPy Code
5757

58-
```bash
59-
# This installs into .venv/ in your project
60-
pip install dspy-code
61-
```
62-
63-
That's it! DSPy Code is now installed in your project.
58+
=== "pip"
6459

65-
### From Source
60+
```bash
61+
# This installs into .venv/ in your project
62+
pip install --upgrade dspy-code
63+
```
6664

67-
If you want the latest development version:
65+
=== "uv"
6866

69-
```bash
70-
# Clone the repository
71-
git clone https://github.com/superagentic-ai/dspy-code.git
72-
cd dspy-code
67+
```bash
68+
# If you use uv, you can install dspy-code like this
69+
uv pip install --upgrade dspy-code
70+
```
7371

74-
# Install in development mode
75-
pip install -e .
76-
```
72+
That's it! DSPy Code is now installed in your project.
7773

78-
## Install DSPy
74+
### Step 4: Install DSPy (Optional)
7975

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:
8177

82-
```bash
83-
pip install dspy
84-
```
78+
=== "pip"
8579

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+
```
8883

89-
### Step 4: Install DSPy (Optional)
84+
=== "uv"
9085

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+
```
9689

9790
!!! 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.
9992

10093
## Verify Installation
10194

@@ -156,27 +149,47 @@ my-dspy-project/
156149

157150
## Optional Dependencies
158151

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.
160153

161-
### For OpenAI Models
154+
### Cloud Model Providers (via dspy-code extras)
162155

163-
```bash
164-
pip install openai
165-
```
156+
Use extras so versions stay aligned with dspy-code’s tested matrix.
166157

167-
### For Anthropic Claude
158+
=== "pip"
168159

169-
```bash
170-
pip install anthropic
171-
```
160+
```bash
161+
# OpenAI support
162+
pip install "dspy-code[openai]"
172163

173-
### For Google Gemini
164+
# Google Gemini support
165+
pip install "dspy-code[gemini]"
174166

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.
178191
179-
### For Semantic Similarity Metrics
192+
### Semantic Similarity Metrics
180193

181194
```bash
182195
pip install sentence-transformers scikit-learn

docs/getting-started/quick-start.md

Lines changed: 74 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,47 @@
22

33
Get started with DSPy Code in 5 minutes! This guide will walk you through creating your first DSPy program.
44

5-
## Prerequisites
5+
## Prerequisites (One‑Time Setup)
66

7-
Before starting, make sure you have:
7+
You only need to do this once for each new DSPy project.
88

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
1227

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).
1446

1547
## Step 1: Navigate to Your Project
1648

@@ -56,7 +88,30 @@ You'll see a beautiful welcome screen with the DSPy version and helpful tips.
5688
💬 Or just describe what you want to build!
5789
```
5890

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
60115

61116
Inside the CLI, type:
62117

@@ -73,7 +128,7 @@ This will:
73128
!!! tip "What's Happening?"
74129
The `/init` command scans your installed DSPy version and your project code. This lets DSPy Code answer questions about DSPy and understand your project!
75130

76-
## Step 3: Generate Your First Program
131+
## Step 5: Generate Your First Program
77132

78133
Now for the fun part! Just describe what you want in plain English:
79134

@@ -106,7 +161,7 @@ DSPy Code will:
106161
return self.predictor(text=text)
107162
```
108163

109-
## Step 4: Save Your Code
164+
## Step 6: Save Your Code
110165

111166
Save the generated code to a file:
112167

@@ -121,7 +176,7 @@ The file will be saved to your `generated/` directory.
121176
✓ Code saved to: generated/sentiment.py
122177
```
123178

124-
## Step 5: Validate Your Code
179+
## Step 7: Validate Your Code
125180

126181
Check if your code follows DSPy best practices:
127182

@@ -139,7 +194,7 @@ DSPy Code will check for:
139194
!!! tip "Quality Checks"
140195
The validator catches common mistakes and suggests improvements. It's like having an expert review your code!
141196

142-
## Step 6: Run Your Program
197+
## Step 8: Run Your Program
143198

144199
Test your program:
145200

@@ -154,30 +209,17 @@ DSPy Code will execute your code in a safe sandbox and show you the results.
154209
You just:
155210

156211
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
162218

163219
## What's Next?
164220

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.
181223

182224
### Try More Examples
183225

docs/getting-started/understanding.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ GEPA (Genetic Pareto) optimizes DSPy programs by:
345345
4. **Selection**: Keep best versions
346346
5. **Iteration**: Repeat until optimal
347347

348+
!!! warning "Optimization Cost & Resource Considerations"
349+
- **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+
348353
### Optimization Process
349354

350355
**1. Prepare Data:**
@@ -411,22 +416,24 @@ This feedback helps GEPA learn!
411416
/connect ollama llama3.1:8b
412417
```
413418

414-
**2. OpenAI:**
419+
**2. OpenAI (modern SDK, example small model):**
415420

416421
```
417-
/connect openai gpt-4
422+
/connect openai gpt-5-nano
418423
```
419424

420-
**3. Anthropic:**
425+
**3. Anthropic (paid only, optional):**
421426

422427
```
423-
/connect anthropic claude-3-sonnet
428+
/connect anthropic claude-sonnet-4.5
424429
```
425430

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.
432+
433+
**4. Gemini (via google-genai):**
427434

428435
```
429-
/connect gemini gemini-pro
436+
/connect gemini gemini-2.5-flash
430437
```
431438

432439
### Connection Process

0 commit comments

Comments
 (0)