Skip to content

Commit

Permalink
Merge pull request #77 from parea-ai/fix-bug
Browse files Browse the repository at this point in the history
fix nits
  • Loading branch information
jalexanderII committed Sep 7, 2023
2 parents 23344ca + 8807630 commit 7e71951
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parea/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __attrs_post_init__(self):
parea_logger.set_client(self._client)

def completion(self, data: Completion) -> CompletionResponse:
data.inference_id = get_current_trace_id()
data.inference_id = get_current_trace_id() or None
r = self._client.request(
"POST",
COMPLETION_ENDPOINT,
Expand Down
1 change: 1 addition & 0 deletions parea/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CompletionResponse:
start_timestamp: str
end_timestamp: str
error: Optional[str] = None
trace_id: Optional[str] = None


@define
Expand Down
5 changes: 4 additions & 1 deletion parea/utils/trace_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def merge(old, new):


def get_current_trace_id() -> str:
return trace_context.get()[-1]
stack = trace_context.get()
if stack:
return stack[-1]
return ""


def trace_insert(data: dict[str, Any]):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "parea-ai"
packages = [{ include = "parea" }]
version = "0.2.3"
version = "0.2.4"
description = "Parea python sdk"
readme = "README.md"
authors = ["joel-parea-ai <[email protected]>"]
Expand Down

0 comments on commit 7e71951

Please sign in to comment.