Skip to content

Commit

Permalink
fix: pyright errors
Browse files Browse the repository at this point in the history
  • Loading branch information
William Bakst committed Dec 14, 2024
1 parent c042e44 commit fb459ac
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: ruff-format
files: "^mirascope|^tests|^examples|^docs"
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.389
rev: v1.1.390
hooks:
- id: pyright
- repo: local
Expand Down
36 changes: 0 additions & 36 deletions mirascope/core/base/call_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,42 +50,6 @@
)


# def transform_tool_outputs(
# fn: Callable[[type[_BaseCallResponseT], list[tuple[_BaseToolT, str]]], list[Any]],
# ) -> Callable[
# [type[_BaseCallResponseT], list[tuple[_BaseToolT, JsonableType]]],
# list[Any],
# ]:
# @wraps(fn)
# def wrapper(
# cls: type[_BaseCallResponseT],
# tools_and_outputs: list[tuple[_BaseToolT, JsonableType]],
# ) -> list[Any]:
# def recursive_serializer(value: JsonableType) -> str:
# if isinstance(value, str):
# return value
# if isinstance(value, int | float | bool):
# return json.dumps(value)
# if isinstance(value, bytes):
# return base64.b64encode(value).decode("utf-8")
# if isinstance(value, BaseModel):
# return value.model_dump_json()
# if isinstance(value, list | set | tuple):
# serialized_items = [recursive_serializer(item) for item in value]
# return json.dumps(serialized_items)
# if isinstance(value, dict):
# serialized_dict = {k: recursive_serializer(v) for k, v in value.items()}
# return json.dumps(serialized_dict)
# raise TypeError(f"Unsupported type for serialization: {type(value)}")

# transformed_tools_and_outputs = [
# (tool, recursive_serializer(output)) for tool, output in tools_and_outputs
# ]
# return fn(cls, transformed_tools_and_outputs)

# return wrapper


def transform_tool_outputs(
fn: Callable[[type[_BaseCallResponseT], list[tuple[_BaseToolT, str]]], list[Any]],
) -> Callable[
Expand Down
4 changes: 2 additions & 2 deletions mirascope/core/base/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)
from .call_kwargs import BaseCallKwargs
from .call_params import BaseCallParams
from .call_response import BaseCallResponse
from .call_response import BaseCallResponse, JsonableType
from .call_response_chunk import BaseCallResponseChunk
from .dynamic_config import BaseDynamicConfig
from .messages import Messages
Expand Down Expand Up @@ -217,7 +217,7 @@ def _construct_message_param(
...

def tool_message_params(
self, tools_and_outputs: list[tuple[_BaseToolT, str]]
self, tools_and_outputs: list[tuple[_BaseToolT, JsonableType]]
) -> list[_ToolMessageParamT]:
"""Returns the tool message parameters for tool call results.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mcp = ["mcp>=1.0.0"]
dev-dependencies = [
"ruff>=0.6.1",
"pytest>=8.3.2",
"pyright>=1.1.389",
"pyright>=1.1.390",
"pytest-asyncio>=0.23.8",
"pytest-cov>=5.0.0",
"pre-commit>=3.8.0",
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

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

0 comments on commit fb459ac

Please sign in to comment.