fiddler-langgraph 1.0.0__tar.gz → 1.1.0__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.
Files changed (23) hide show
  1. {fiddler_langgraph-1.0.0/fiddler_langgraph.egg-info → fiddler_langgraph-1.1.0}/PKG-INFO +1 -1
  2. fiddler_langgraph-1.1.0/fiddler_langgraph/VERSION +1 -0
  3. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/core/attributes.py +1 -0
  4. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/tracing/callback.py +32 -0
  5. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/tracing/jsonl_capture.py +1 -0
  6. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0/fiddler_langgraph.egg-info}/PKG-INFO +1 -1
  7. fiddler_langgraph-1.0.0/fiddler_langgraph/VERSION +0 -1
  8. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/MANIFEST.in +0 -0
  9. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/PUBLIC.md +0 -0
  10. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/README.md +0 -0
  11. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/__init__.py +0 -0
  12. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/core/__init__.py +0 -0
  13. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/core/client.py +0 -0
  14. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/core/span_processor.py +0 -0
  15. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/tracing/__init__.py +0 -0
  16. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/tracing/instrumentation.py +0 -0
  17. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph/tracing/util.py +0 -0
  18. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph.egg-info/SOURCES.txt +0 -0
  19. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph.egg-info/dependency_links.txt +0 -0
  20. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph.egg-info/requires.txt +0 -0
  21. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/fiddler_langgraph.egg-info/top_level.txt +0 -0
  22. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/pyproject.toml +0 -0
  23. {fiddler_langgraph-1.0.0 → fiddler_langgraph-1.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fiddler-langgraph
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Python SDK for instrumenting GenAI Applications with Fiddler
5
5
  Home-page: https://fiddler.ai
6
6
  Author: Fiddler AI
@@ -0,0 +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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fiddler-langgraph
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Python SDK for instrumenting GenAI Applications with Fiddler
5
5
  Home-page: https://fiddler.ai
6
6
  Author: Fiddler AI
@@ -1 +0,0 @@
1
- 1.0.0