promptbuilder 0.4.33__tar.gz → 0.4.34__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {promptbuilder-0.4.33/promptbuilder.egg-info → promptbuilder-0.4.34}/PKG-INFO +1 -1
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/logfire_decorators.py +3 -3
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/types.py +6 -4
- {promptbuilder-0.4.33 → promptbuilder-0.4.34/promptbuilder.egg-info}/PKG-INFO +1 -1
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/setup.py +1 -1
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/LICENSE +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/MANIFEST.in +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/Readme.md +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/__init__.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/agent/__init__.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/agent/agent.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/agent/context.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/agent/tool.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/agent/utils.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/embeddings.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/__init__.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/aisuite_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/anthropic_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/base_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/bedrock_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/config.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/exceptions.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/google_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/litellm_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/main.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/openai_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/utils.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/vertex_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/prompt_builder.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder.egg-info/SOURCES.txt +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder.egg-info/dependency_links.txt +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder.egg-info/requires.txt +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder.egg-info/top_level.txt +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/pyproject.toml +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/setup.cfg +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/tests/test_llm_client.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/tests/test_llm_client_async.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/tests/test_timeout_google.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/tests/test_timeout_litellm.py +0 -0
- {promptbuilder-0.4.33 → promptbuilder-0.4.34}/tests/test_timeout_openai.py +0 -0
{promptbuilder-0.4.33 → promptbuilder-0.4.34}/promptbuilder/llm_client/logfire_decorators.py
RENAMED
|
@@ -7,7 +7,7 @@ import logfire
|
|
|
7
7
|
|
|
8
8
|
from promptbuilder.llm_client.utils import inherited_decorator
|
|
9
9
|
from promptbuilder.llm_client.config import GLOBAL_CONFIG
|
|
10
|
-
from promptbuilder.llm_client.types import Response, UsageMetadata
|
|
10
|
+
from promptbuilder.llm_client.types import Response, UsageMetadata, content_to_str
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
P = ParamSpec("P")
|
|
@@ -24,9 +24,9 @@ def extract_span_data(self, *args, **kwargs) -> dict[str, Any]:
|
|
|
24
24
|
logfire_messages.append({"role": "system", "content": system_message})
|
|
25
25
|
for content in messages:
|
|
26
26
|
if content.role == "user":
|
|
27
|
-
logfire_messages.append({"role": "user", "content": content
|
|
27
|
+
logfire_messages.append({"role": "user", "content": content_to_str(content)})
|
|
28
28
|
elif content.role == "model":
|
|
29
|
-
logfire_messages.append({"role": "assistant", "content": content
|
|
29
|
+
logfire_messages.append({"role": "assistant", "content": content_to_str(content)})
|
|
30
30
|
span_data["request_data"] = {"messages": logfire_messages}
|
|
31
31
|
span_data["messages"] = messages
|
|
32
32
|
|
|
@@ -96,11 +96,13 @@ class Content(BaseModel):
|
|
|
96
96
|
role: Role | None = None
|
|
97
97
|
|
|
98
98
|
def as_str(self) -> str:
|
|
99
|
-
|
|
100
|
-
return ""
|
|
101
|
-
else:
|
|
102
|
-
return "\n".join([(part.text or "") for part in self.parts])
|
|
99
|
+
return content_to_str(self)
|
|
103
100
|
|
|
101
|
+
def content_to_str(content: Content) -> str:
|
|
102
|
+
if content.parts is None:
|
|
103
|
+
return ""
|
|
104
|
+
else:
|
|
105
|
+
return "".join([part.text for part in content.parts if part.text])
|
|
104
106
|
|
|
105
107
|
class FinishReason(Enum):
|
|
106
108
|
"""Output only. The reason why the model stopped generating tokens.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|