fiddler-langgraph 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl
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.
- fiddler_langgraph/VERSION +1 -1
- fiddler_langgraph/core/attributes.py +1 -0
- fiddler_langgraph/tracing/callback.py +32 -0
- fiddler_langgraph/tracing/jsonl_capture.py +1 -0
- {fiddler_langgraph-1.0.0.dist-info → fiddler_langgraph-1.1.0.dist-info}/METADATA +1 -1
- {fiddler_langgraph-1.0.0.dist-info → fiddler_langgraph-1.1.0.dist-info}/RECORD +8 -8
- {fiddler_langgraph-1.0.0.dist-info → fiddler_langgraph-1.1.0.dist-info}/WHEEL +0 -0
- {fiddler_langgraph-1.0.0.dist-info → fiddler_langgraph-1.1.0.dist-info}/top_level.txt +0 -0
fiddler_langgraph/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.1.0
|
|
@@ -39,6 +39,7 @@ class FiddlerSpanAttributes: # pylint: disable=too-few-public-methods
|
|
|
39
39
|
TOOL_INPUT = 'gen_ai.tool.input'
|
|
40
40
|
TOOL_OUTPUT = 'gen_ai.tool.output'
|
|
41
41
|
TOOL_NAME = 'gen_ai.tool.name'
|
|
42
|
+
TOOL_DEFINITIONS = 'gen_ai.tool.definitions'
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
class FiddlerResourceAttributes:
|
|
@@ -138,6 +138,32 @@ def _set_token_usage_attributes(span: trace.Span, response: LLMResult) -> None:
|
|
|
138
138
|
logger.warning('Failed to extract token usage: %s', e)
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
def _set_tool_definitions(span: trace.Span, kwargs: dict[str, Any]) -> None:
|
|
142
|
+
"""Extract and set tool definitions on the span.
|
|
143
|
+
|
|
144
|
+
Retrieves tool definitions from invocation params and stores them as a
|
|
145
|
+
JSON-serialized string attribute on the span.
|
|
146
|
+
|
|
147
|
+
Parameters
|
|
148
|
+
----------
|
|
149
|
+
span : trace.Span
|
|
150
|
+
The OpenTelemetry span to set attributes on
|
|
151
|
+
kwargs : dict[str, Any]
|
|
152
|
+
Callback kwargs containing invocation_params
|
|
153
|
+
|
|
154
|
+
"""
|
|
155
|
+
try:
|
|
156
|
+
invocation_params = kwargs.get('invocation_params', {})
|
|
157
|
+
tools = invocation_params.get('tools')
|
|
158
|
+
|
|
159
|
+
if tools and isinstance(tools, list) and len(tools) > 0:
|
|
160
|
+
# Store tool definitions as-is in OpenAI native format
|
|
161
|
+
tool_definitions_json = json.dumps(tools, cls=_LanggraphJSONEncoder)
|
|
162
|
+
span.set_attribute(FiddlerSpanAttributes.TOOL_DEFINITIONS, tool_definitions_json)
|
|
163
|
+
except Exception as e:
|
|
164
|
+
logger.warning('Failed to extract tool definitions: %s', e)
|
|
165
|
+
|
|
166
|
+
|
|
141
167
|
class _CallbackHandler(BaseCallbackHandler):
|
|
142
168
|
"""A LangChain callback handler that creates OpenTelemetry spans for Fiddler.
|
|
143
169
|
|
|
@@ -641,6 +667,9 @@ class _CallbackHandler(BaseCallbackHandler):
|
|
|
641
667
|
# Set model attributes
|
|
642
668
|
_set_model_attributes(child_span, metadata)
|
|
643
669
|
|
|
670
|
+
# Extract and set tool definitions
|
|
671
|
+
_set_tool_definitions(child_span, kwargs)
|
|
672
|
+
|
|
644
673
|
# We are only taking the 1st system message and 1st user message
|
|
645
674
|
# as we are not supporting multiple system messages or multiple user messages
|
|
646
675
|
# To support multiple system messages, we would need to add a new attribute with indexing
|
|
@@ -703,6 +732,9 @@ class _CallbackHandler(BaseCallbackHandler):
|
|
|
703
732
|
# Set model attributes
|
|
704
733
|
_set_model_attributes(child_span, metadata)
|
|
705
734
|
|
|
735
|
+
# Extract and set tool definitions
|
|
736
|
+
_set_tool_definitions(child_span, kwargs)
|
|
737
|
+
|
|
706
738
|
# LLM model is more generic than a chat model, it only has a list on prompts
|
|
707
739
|
# we are using the first prompt as both the system message and the user message
|
|
708
740
|
# to capture all the prompts, we would need to add a new attribute with indexing
|
|
@@ -103,6 +103,7 @@ class JSONLSpanCapture:
|
|
|
103
103
|
span_data['tool_name'] = attributes.get(FiddlerSpanAttributes.TOOL_NAME, '')
|
|
104
104
|
span_data['tool_input'] = attributes.get(FiddlerSpanAttributes.TOOL_INPUT, '')
|
|
105
105
|
span_data['tool_output'] = attributes.get(FiddlerSpanAttributes.TOOL_OUTPUT, '')
|
|
106
|
+
span_data['tool_definitions'] = attributes.get(FiddlerSpanAttributes.TOOL_DEFINITIONS, '')
|
|
106
107
|
|
|
107
108
|
# Library versions (from resource if available)
|
|
108
109
|
resource_attributes = (
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
fiddler_langgraph/VERSION,sha256=
|
|
1
|
+
fiddler_langgraph/VERSION,sha256=FXXhr0qV8S9wtO5qatzoFglT2T6hfcJhG5CIPMw607g,6
|
|
2
2
|
fiddler_langgraph/__init__.py,sha256=cqomWAmuY-2KvwJTvo7c7cecCPoe31pv4vgyBk_E8oQ,315
|
|
3
3
|
fiddler_langgraph/core/__init__.py,sha256=HXPZt8YpmVrvwEEukoWR78LufMKtl7lVjLtcl9UNSoc,42
|
|
4
|
-
fiddler_langgraph/core/attributes.py,sha256=
|
|
4
|
+
fiddler_langgraph/core/attributes.py,sha256=kVu2F7XcdOA6216owWUrb49tps0DXAgM-DhNNgkk0E8,2218
|
|
5
5
|
fiddler_langgraph/core/client.py,sha256=Fn4sPiTfAF1i375Qg_9DYwD0wAT65K6j3M9luyTVKPE,14948
|
|
6
6
|
fiddler_langgraph/core/span_processor.py,sha256=ODYmdo0FUYEFbIWS_VaR9L6qHUVvpnuk-RSIhgRxyb0,1164
|
|
7
7
|
fiddler_langgraph/tracing/__init__.py,sha256=Kw8VUB7RDffBq4ss0v6vNQYi4KDQOM0J1elbMrqJpsU,49
|
|
8
|
-
fiddler_langgraph/tracing/callback.py,sha256=
|
|
8
|
+
fiddler_langgraph/tracing/callback.py,sha256=h75rSCl4XLNAScDt0Bh6JmluYxw7_-GQbF6FWok5Xxc,32428
|
|
9
9
|
fiddler_langgraph/tracing/instrumentation.py,sha256=AlCM9GWp3qN_Fa9cl-USJjrUhuvKmrLokzkLMgah-CY,21142
|
|
10
|
-
fiddler_langgraph/tracing/jsonl_capture.py,sha256=
|
|
10
|
+
fiddler_langgraph/tracing/jsonl_capture.py,sha256=ju5JHGZKjUsRduAjlJMjHj_jQyLP1Tr9jzRR0j_Yatc,8273
|
|
11
11
|
fiddler_langgraph/tracing/util.py,sha256=RKMrrmdCXSRJrTIHngdhRsotPLEY_LR1SKnUXAJC40Y,2678
|
|
12
|
-
fiddler_langgraph-1.
|
|
13
|
-
fiddler_langgraph-1.
|
|
14
|
-
fiddler_langgraph-1.
|
|
15
|
-
fiddler_langgraph-1.
|
|
12
|
+
fiddler_langgraph-1.1.0.dist-info/METADATA,sha256=b1ad_wYbBcEugKM3c1fkYEGtLI-WHqxA0diq4j66QwM,10424
|
|
13
|
+
fiddler_langgraph-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
fiddler_langgraph-1.1.0.dist-info/top_level.txt,sha256=hOKdR6_3AkS4dS6EfE9Ii7YrS_hApnyGfY-0v0DV0s4,18
|
|
15
|
+
fiddler_langgraph-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|