Skip to content

Commit

Permalink
Merge pull request #807 from Mirascope/fix-805-806
Browse files Browse the repository at this point in the history
Fix tooklit example, logfire support bump, remove extra computed field decorator
  • Loading branch information
willbakst authored Feb 9, 2025
2 parents a021ef0 + be35691 commit 1b2d650
Show file tree
Hide file tree
Showing 44 changed files with 46 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/learn/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,9 @@ The `BaseToolKit` class enables:
=== "{{ provider }}"

{% if method == "string_template" %}
```python hl_lines="10 11 13 15 19 27 28 33 36 38 41"
```python hl_lines="10 11 13 15 19 28 29 34 37 39 42"
{% else %}
```python hl_lines="10 11 13 15 19 26 28 33 36 38 41"
```python hl_lines="10 11 13 15 19 27 29 34 37 39 42"
{% endif %}
--8<-- "examples/learn/tools/toolkit/{{ provider | provider_dir }}/{{ method }}.py"
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/anthropic/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/anthropic/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/anthropic/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/azure/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/azure/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/azure/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/azure/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/bedrock/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/bedrock/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/bedrock/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/bedrock/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/cohere/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/cohere/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/cohere/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/cohere/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/gemini/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/gemini/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/gemini/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/gemini/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/groq/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/groq/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/groq/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/groq/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/litellm/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/litellm/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/litellm/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/litellm/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/mistral/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/mistral/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/mistral/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/mistral/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/openai/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/openai/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/openai/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/openai/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/vertex/base_message_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/vertex/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/vertex/shorthand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 1 addition & 0 deletions examples/learn/tools/toolkit/vertex/string_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def suggest_author(self, author: str) -> str:
"""Suggests an author for the user to read based on their reading level.
User reading level: {self.reading_level}
Author you suggest must be appropriate for the user's reading level.
"""
return f"I would suggest you read some books by {author}"

Expand Down
1 change: 0 additions & 1 deletion mirascope/llm/call_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def __getattribute__(self, name: str) -> Any: # noqa: ANN401
def __str__(self) -> str:
return str(self._response)

@computed_field
@computed_field
@property
def finish_reasons(self) -> list[FinishReason] | None: # pyright: ignore [reportIncompatibleMethodOverride]
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mirascope"
version = "1.16.7"
version = "1.16.8"
description = "LLM abstractions that aren't obstructions"
readme = "README.md"
license = { file = "LICENSE" }
Expand Down Expand Up @@ -72,7 +72,7 @@ tenacity = ["tenacity>=8.4.2,<9"]
hyperdx = ["hyperdx-opentelemetry>=0.1.0,<1"]
langfuse = ["langfuse>=2.30.0,<3"]
litellm = ["litellm>=1.42.12,<2"]
logfire = ["logfire>=1.0.0,<3"]
logfire = ["logfire>=1.0.0,<4"]
mistral = ["mistralai>=1.0.0,<2"]
openai = ["openai>=1.6.0,<2"]
opentelemetry = ["opentelemetry-api>=1.22.0,<2", "opentelemetry-sdk>=1.22.0,<2"]
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1b2d650

Please sign in to comment.