Skip to content

Commit b77cc97

Browse files
Reorganize examples (#507)
Co-authored-by: Samuel Colvin <[email protected]>
1 parent 62fc557 commit b77cc97

29 files changed

+52
-48
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ env*/
1010
/TODO.md
1111
/postgres-data/
1212
.DS_Store
13-
/pydantic_ai_examples/.chat_app_messages.sqlite
13+
examples/pydantic_ai_examples/.chat_app_messages.sqlite
1414
.cache/
1515
.vscode/

docs/.hooks/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ def sub_run(m: re.Match[str]) -> str:
4848
```"""
4949

5050

51-
EXAMPLES_DIR = Path(__file__).parent.parent.parent / 'pydantic_ai_examples'
51+
EXAMPLES_DIR = Path(__file__).parent.parent.parent / 'examples'
5252

5353

5454
def render_examples(markdown: str) -> str:
55-
return re.sub(r'^#! *pydantic_ai_examples/(.+)', sub_example, markdown, flags=re.M)
55+
return re.sub(r'^#! *examples/(.+)', sub_example, markdown, flags=re.M)
5656

5757

5858
def sub_example(m: re.Match[str]) -> str:

docs/examples/bank-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ python/uv-run -m pydantic_ai_examples.bank_support
1919
## Example Code
2020

2121
```python {title="bank_support.py"}
22-
#! pydantic_ai_examples/bank_support.py
22+
#! examples/pydantic_ai_examples/bank_support.py
2323
```

docs/examples/chat-app.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ TODO screenshot.
3030
Python code that runs the chat app:
3131

3232
```python {title="chat_app.py"}
33-
#! pydantic_ai_examples/chat_app.py
33+
#! examples/pydantic_ai_examples/chat_app.py
3434
```
3535

3636
Simple HTML page to render the app:
3737

3838
```html {title="chat_app.html"}
39-
#! pydantic_ai_examples/chat_app.html
39+
#! examples/pydantic_ai_examples/chat_app.html
4040
```
4141

4242
TypeScript to handle rendering the messages, to keep this simple (and at the risk of offending frontend developers) the typescript code is passed to the browser as plain text and transpiled in the browser.
4343

4444
```ts {title="chat_app.ts"}
45-
#! pydantic_ai_examples/chat_app.ts
45+
#! examples/pydantic_ai_examples/chat_app.ts
4646
```

docs/examples/pydantic-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ PYDANTIC_AI_MODEL=gemini-1.5-pro python/uv-run -m pydantic_ai_examples.pydantic_
2626
## Example Code
2727

2828
```python {title="pydantic_model.py"}
29-
#! pydantic_ai_examples/pydantic_model.py
29+
#! examples/pydantic_ai_examples/pydantic_model.py
3030
```

docs/examples/rag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ python/uv-run -m pydantic_ai_examples.rag search "How do I configure logfire to
4545
## Example Code
4646

4747
```python {title="rag.py"}
48-
#! pydantic_ai_examples/rag.py
48+
#! examples/pydantic_ai_examples/rag.py
4949
```

docs/examples/sql-gen.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ This model uses `gemini-1.5-flash` by default since Gemini is good at single sho
3535
## Example Code
3636

3737
```python {title="sql_gen.py"}
38-
#! pydantic_ai_examples/sql_gen.py
38+
#! examples/pydantic_ai_examples/sql_gen.py
3939
```

docs/examples/stream-markdown.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ python/uv-run -m pydantic_ai_examples.stream_markdown
1717
## Example Code
1818

1919
```python
20-
#! pydantic_ai_examples/stream_markdown.py
20+
#! examples/pydantic_ai_examples/stream_markdown.py
2121
```

docs/examples/stream-whales.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ Should give an output like this:
2222
## Example Code
2323

2424
```python {title="stream_whales.py"}
25-
#! pydantic_ai_examples/stream_whales.py
25+
#! examples/pydantic_ai_examples/stream_whales.py
2626
```

docs/examples/weather-agent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ python/uv-run -m pydantic_ai_examples.weather_agent
2626
## Example Code
2727

2828
```python {title="pydantic_ai_examples/weather_agent.py"}
29-
#! pydantic_ai_examples/weather_agent.py
29+
#! examples/pydantic_ai_examples/weather_agent.py
3030
```

0 commit comments

Comments
 (0)