Skip to content

Commit

Permalink
docs social cards and cleanup (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin authored Nov 14, 2024
1 parent d3396ad commit 48d2fd1
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
env:
PPPR_TOKEN: ${{ secrets.PPPR_TOKEN }}

- run: uv pip freeze
- run: tree site

test:
name: test on ${{ matrix.python-version }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ env*/
/postgres-data/
.DS_Store
/pydantic_ai_examples/.chat_app_messages.jsonl
.cache/
.docs-insiders-install
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ docs-serve-insiders: .docs-insiders-install
.PHONY: cf-pages-build # Install uv, install dependencies and build the docs, used on CloudFlare Pages
cf-pages-build:
curl -LsSf https://astral.sh/uv/install.sh | sh
${HOME}/.local/bin/uv python install 3.12
${HOME}/.local/bin/uv sync --python 3.12 --frozen --group docs
${HOME}/.local/bin/uv pip install -U \
uv python install 3.12
uv sync --python 3.12 --frozen --group docs
uv pip install -U \
--extra-index-url https://pydantic:$(PPPR_TOKEN)@pppr.pydantic.dev/simple/ \
mkdocs-material mkdocstrings-python
${HOME}/.local/bin/uv pip freeze
${HOME}/.local/bin/uv run --no-sync mkdocs build
uv pip freeze
uv run --no-sync mkdocs build

.PHONY: all
all: format lint typecheck testcov
2 changes: 0 additions & 2 deletions docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ Then set the API key as an environment variable with:

### Running Examples

These examples are distributed with the `pydantic-ai` package so you can run them either by cloning the [pydantic-ai repo](https://github.com/pydantic/pydantic-ai) or by simply installing `pydantic-ai` from PyPI with `pip` or `uv`.

To run the examples (this will work whether you installed `pydantic_ai`, or cloned the repo), run:

```bash
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/stream-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ hide: [toc]

This example shows how to stream markdown from an agent, using the [`rich`](https://github.com/Textualize/rich) library to highlight the output in the terminal.

It'll run the example with both OpenAI and Google Gemini models if the required environment variables are set.

Demonstrates:

* streaming text responses
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/weather-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ the `get_weather` tool to get the weather for those locations.

## Running the Example

To run this example properly, you'll need two extra API keys:
To run this example properly, you might want to add two extra API keys **(Note if either key is missing, the code will fall back to dummy data, so they're not required)**:

* A weather API key from [tomorrow.io](https://www.tomorrow.io/weather-api/) set via `WEATHER_API_KEY`
* A geocoding API key from [geocode.maps.co](https://geocode.maps.co/) set via `GEO_API_KEY`

**(Note if either key is missing, the code will fall back to dummy data.)**

With [dependencies installed and environment variables set](./index.md#usage), run:

```bash
python/uv-run -m pydantic_ai_examples.pydantic_model
python/uv-run -m pydantic_ai_examples.weather_agent
```

## Example Code
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p align="center">
<img src="./img/pydantic-ai-dark.svg#only-dark" alt="PydanticAI">
<img src="./img/pydantic-ai-dark.svg#only-dark" alt="PydanticAI" style="max-width: 600px">
</p>
<p align="center">
<img src="./img/pydantic-ai-light.svg#only-light" alt="PydanticAI">
<img src="./img/pydantic-ai-light.svg#only-light" alt="PydanticAI" style="max-width: 600px">
</p>
<p align="center">
<em>Agent Framework / shim to use Pydantic with LLMs</em>
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ watch:

plugins:
- search
- social
- mkdocstrings:
handlers:
python:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dev = [
]
docs = [
"mkdocs",
"mkdocs-material",
"mkdocs-material[imaging]",
"mkdocstrings-python",
]

Expand Down
236 changes: 234 additions & 2 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit 48d2fd1

Please sign in to comment.