Skip to content

Commit

Permalink
Add shebang to examples and make them executable (#14)
Browse files Browse the repository at this point in the history
* Add uv shebang to examples

* Make examples executable
  • Loading branch information
mattt authored Jan 28, 2025
1 parent 5f1991d commit 55204bd
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions examples/interactive.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to create interactive tools.
Expand Down
2 changes: 2 additions & 0 deletions examples/output_shaping.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to use output shaping with Anthropic models.
Expand Down
2 changes: 2 additions & 0 deletions examples/rag.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to do Retrieval Augmented Generation (RAG) with OpenAI,
using the `sqlite-vec` extension to store and query the embeddings
Expand Down
2 changes: 2 additions & 0 deletions examples/rpc.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to serve a function over HTTP with Hype.
Expand Down
6 changes: 4 additions & 2 deletions examples/sudoku.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to extract tables from an image.
This example shows how to solve Sudoku puzzles with OpenAI.
Download `uv` to run this example: https://github.com/astral-sh/uv
```
export OPENAI_API_KEY="..."
uv run examples/extract_tables.py
uv run examples/sudoku.py
```
"""

Expand Down
2 changes: 2 additions & 0 deletions examples/system_events.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to use Ollama and macOS System Events together.
Expand Down
4 changes: 3 additions & 1 deletion examples/text_analysis.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to construct a simple text analysis tool using Hype.
Expand Down Expand Up @@ -27,7 +29,7 @@ class TextAnalysis(BaseModel):
description="Flesch reading ease score (0-100, higher is easier)"
)

@field_validator('reading_ease')
@field_validator("reading_ease")
def clamp_reading_ease(cls, v: float) -> float:
"""Clamp reading ease score between 0 and 100"""
return max(0, min(100, v))
Expand Down
2 changes: 2 additions & 0 deletions examples/tool_use.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to use tools with Anthropic models.
Expand Down
2 changes: 2 additions & 0 deletions examples/web_scraping.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S uv run --script

"""
This example shows how to use tools with Anthropic models.
Expand Down

0 comments on commit 55204bd

Please sign in to comment.