Skip to content

Commit

Permalink
Don't serialize result
Browse files Browse the repository at this point in the history
  • Loading branch information
jakethekoenig committed May 27, 2024
1 parent 880f105 commit af9191f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packages=["spice"]

[project]
name = "spiceai"
version = "0.3.8"
version = "0.3.9"
license = {text = "Apache-2.0"}
description = "A Python library for building AI-powered applications."
readme = "README.md"
Expand Down
3 changes: 2 additions & 1 deletion spice/spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SpiceResponse(Generic[T]):
cost: Optional[float]
"""The cost of this request in cents. May be inaccurate for incompleted streamed responses. Will be None if the cost of the model used is not known."""

_result: T | None = field(default=None, repr=False)
_result: T | None = field(default=None)
"""The result of the LLM call. This will be the same as text if no converter was given."""

@property
Expand Down Expand Up @@ -288,6 +288,7 @@ def _log_response(self, response: SpiceResponse, name: Optional[str] = None):
full_name = f"{base_name}_{self._cur_logged_names[base_name]}.json"
self._cur_logged_names[base_name] += 1
response_dict = dataclasses.asdict(response)
response_dict.pop("_result", "") # May not be serializable
response_json = json.dumps(response_dict, cls=MessagesEncoder)

logging_dir = self.logging_dir / self._cur_run
Expand Down

0 comments on commit af9191f

Please sign in to comment.