fiddler-langgraph 0.1.0rc1__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 -0
- fiddler_langgraph/__init__.py +11 -0
- fiddler_langgraph/core/__init__.py +1 -0
- fiddler_langgraph/core/attributes.py +87 -0
- fiddler_langgraph/core/client.py +318 -0
- fiddler_langgraph/core/span_processor.py +31 -0
- fiddler_langgraph/tracing/__init__.py +1 -0
- fiddler_langgraph/tracing/callback.py +795 -0
- fiddler_langgraph/tracing/instrumentation.py +264 -0
- fiddler_langgraph/tracing/jsonl_capture.py +185 -0
- fiddler_langgraph/tracing/util.py +83 -0
- fiddler_langgraph-0.1.0rc1.dist-info/METADATA +323 -0
- fiddler_langgraph-0.1.0rc1.dist-info/RECORD +15 -0
- fiddler_langgraph-0.1.0rc1.dist-info/WHEEL +5 -0
- fiddler_langgraph-0.1.0rc1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fiddler-langgraph
|
|
3
|
+
Version: 0.1.0rc1
|
|
4
|
+
Summary: Python SDK for instrumenting GenAI Applications with Fiddler
|
|
5
|
+
Author-email: Fiddler AI <support@fiddler.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://fiddler.ai
|
|
8
|
+
Project-URL: Documentation, https://docs.fiddler.ai
|
|
9
|
+
Project-URL: Repository, https://github.com/fiddler-labs/fiddler-sdk
|
|
10
|
+
Project-URL: Issues, https://github.com/fiddler-labs/fiddler-sdk/issues
|
|
11
|
+
Keywords: fiddler,ai,genai,llm,monitoring,observability,instrumentation,langgraph,langchain,opentelemetry
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Classifier: Topic :: System :: Monitoring
|
|
16
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: pip>=21.0
|
|
26
|
+
Requires-Dist: opentelemetry-api<=1.35.0,>=1.19.0
|
|
27
|
+
Requires-Dist: opentelemetry-sdk<=1.35.0,>=1.19.0
|
|
28
|
+
Requires-Dist: opentelemetry-instrumentation<=0.56b0,>=0.40b0
|
|
29
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http<=1.35.0,>=1.19.0
|
|
30
|
+
Requires-Dist: pydantic>=2.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=8.3.5; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=6.1.1; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.16.1; extra == "dev"
|
|
35
|
+
Requires-Dist: black>=25.1.0; extra == "dev"
|
|
36
|
+
Requires-Dist: isort>=6.0; extra == "dev"
|
|
37
|
+
Requires-Dist: flake8>=7.2.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pre-commit>=4.2.0; extra == "dev"
|
|
39
|
+
Requires-Dist: bandit>=1.8.5; extra == "dev"
|
|
40
|
+
Requires-Dist: pylint>=3.3.7; extra == "dev"
|
|
41
|
+
Requires-Dist: ruff>=0.12.0; extra == "dev"
|
|
42
|
+
Requires-Dist: nox>=2025.5.1; extra == "dev"
|
|
43
|
+
Requires-Dist: tomli==2.2.1; extra == "dev"
|
|
44
|
+
Requires-Dist: langgraph<=1.0.1,>=0.3.28; extra == "dev"
|
|
45
|
+
Requires-Dist: langchain-community<=1.0.0,>=0.3.27; extra == "dev"
|
|
46
|
+
Requires-Dist: langchain-openai<=1.0.0,>=0.2.14; extra == "dev"
|
|
47
|
+
Requires-Dist: langchain-chroma<=1.0.0,>=0.1.6; extra == "dev"
|
|
48
|
+
Requires-Dist: langgraph-supervisor>=0.0.1; extra == "dev"
|
|
49
|
+
|
|
50
|
+
# Fiddler LangGraph SDK
|
|
51
|
+
|
|
52
|
+
SDK for instrumenting GenAI Applications with Fiddler using OpenTelemetry and LangGraph.
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install fiddler-langgraph
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Note**: This SDK supports LangGraph versions >= 0.3.28 and <= 1.0.2 If you already have LangGraph installed in your environment, the SDK will work with your existing version as long as it falls within this range. If LangGraph is not installed or is outside the supported range, you'll get a helpful error message with installation instructions.
|
|
61
|
+
|
|
62
|
+
### With Example Dependencies
|
|
63
|
+
|
|
64
|
+
To run the example scripts in the `examples/` directory:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install fiddler-langgraph[examples]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Development Dependencies
|
|
71
|
+
|
|
72
|
+
For development and testing:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install fiddler-langgraph[dev]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from fiddler_langgraph import FiddlerClient
|
|
82
|
+
|
|
83
|
+
# Initialize the FiddlerClient with basic configuration
|
|
84
|
+
client = FiddlerClient(
|
|
85
|
+
url="https://api.fiddler.ai",
|
|
86
|
+
api_key="fdl_api_key",
|
|
87
|
+
application_id="fdl_application_id" # Must be a valid UUID4
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# For langgraph, you can instrument like below
|
|
91
|
+
from fiddler_langgraph.tracing.instrumentation import LangGraphInstrumentor, set_llm_context, set_conversation_id
|
|
92
|
+
LangGraphInstrumentor(client).instrument()
|
|
93
|
+
|
|
94
|
+
# Set additional context for LLM processing
|
|
95
|
+
from langchain_openai import ChatOpenAI
|
|
96
|
+
model = ChatOpenAI(model='gpt-4o-mini')
|
|
97
|
+
set_llm_context(model, "Previous conversation context")
|
|
98
|
+
|
|
99
|
+
# Set conversation ID for multi-turn conversations
|
|
100
|
+
from langgraph.graph import StateGraph
|
|
101
|
+
workflow = StateGraph(state_schema=State)
|
|
102
|
+
app = workflow.compile()
|
|
103
|
+
set_conversation_id("conversation_123")
|
|
104
|
+
app.invoke({"messages": [{"role": "user", "content": "Write a novel"}]})
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## LangGraph Usage Examples
|
|
108
|
+
|
|
109
|
+
### Basic Instrumentation
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from fiddler_langgraph.tracing.instrumentation import LangGraphInstrumentor
|
|
113
|
+
|
|
114
|
+
# Initialize and instrument
|
|
115
|
+
instrumentor = LangGraphInstrumentor(client)
|
|
116
|
+
instrumentor.instrument()
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Setting LLM Context
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from fiddler_langgraph.tracing.instrumentation import set_llm_context
|
|
123
|
+
from langchain_openai import ChatOpenAI
|
|
124
|
+
|
|
125
|
+
model = ChatOpenAI(model='gpt-4o-mini')
|
|
126
|
+
set_llm_context(model, "User prefers concise responses")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Conversation Tracking
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from fiddler_langgraph.tracing.instrumentation import set_conversation_id
|
|
133
|
+
import uuid
|
|
134
|
+
|
|
135
|
+
# Set conversation ID for tracking multi-turn conversations
|
|
136
|
+
conversation_id = str(uuid.uuid4())
|
|
137
|
+
set_conversation_id(conversation_id)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Configuration
|
|
141
|
+
|
|
142
|
+
The Fiddler SDK provides flexible configuration options for OpenTelemetry integration and performance tuning.
|
|
143
|
+
|
|
144
|
+
### Basic Configuration
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
client = FiddlerClient(
|
|
148
|
+
api_key="your-api-key",
|
|
149
|
+
application_id="your-app-id", # Must be a valid UUID4
|
|
150
|
+
url="https://api.fiddler.ai"
|
|
151
|
+
)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Advanced Configuration
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from opentelemetry.sdk.trace import SpanLimits, sampling
|
|
158
|
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import Compression
|
|
159
|
+
|
|
160
|
+
# Custom span limits for high-volume applications
|
|
161
|
+
custom_limits = SpanLimits(
|
|
162
|
+
max_events=64,
|
|
163
|
+
max_links=64,
|
|
164
|
+
max_span_attributes=64,
|
|
165
|
+
max_event_attributes=64,
|
|
166
|
+
max_link_attributes=64,
|
|
167
|
+
max_span_attribute_length=4096,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# Sampling strategy for production
|
|
171
|
+
sampler = sampling.TraceIdRatioBased(0.1) # Sample 10% of traces
|
|
172
|
+
|
|
173
|
+
client = FiddlerClient(
|
|
174
|
+
api_key="your-api-key",
|
|
175
|
+
application_id="your-app-id",
|
|
176
|
+
span_limits=custom_limits,
|
|
177
|
+
sampler=sampler,
|
|
178
|
+
console_tracer=False, # Set to True for debugging
|
|
179
|
+
compression=Compression.Gzip, # Enable gzip compression (default)
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Compression Options
|
|
184
|
+
|
|
185
|
+
The SDK supports compression for OTLP export to reduce payload size:
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import Compression
|
|
189
|
+
|
|
190
|
+
# Enable gzip compression (default, recommended for production)
|
|
191
|
+
client = FiddlerClient(
|
|
192
|
+
api_key="your-api-key",
|
|
193
|
+
application_id="your-app-id",
|
|
194
|
+
compression=Compression.Gzip,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# Disable compression (useful for debugging or local development)
|
|
198
|
+
client = FiddlerClient(
|
|
199
|
+
api_key="your-api-key",
|
|
200
|
+
application_id="your-app-id",
|
|
201
|
+
compression=Compression.NoCompression,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
# Use deflate compression (alternative to gzip)
|
|
205
|
+
client = FiddlerClient(
|
|
206
|
+
api_key="your-api-key",
|
|
207
|
+
application_id="your-app-id",
|
|
208
|
+
compression=Compression.Deflate,
|
|
209
|
+
)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Environment Variables for Batch Processing
|
|
213
|
+
|
|
214
|
+
Configure batch span processor behavior using environment variables:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
import os
|
|
218
|
+
|
|
219
|
+
# Configure batch processing
|
|
220
|
+
os.environ['OTEL_BSP_MAX_QUEUE_SIZE'] = '500'
|
|
221
|
+
os.environ['OTEL_BSP_SCHEDULE_DELAY_MILLIS'] = '500'
|
|
222
|
+
os.environ['OTEL_BSP_MAX_EXPORT_BATCH_SIZE'] = '50'
|
|
223
|
+
os.environ['OTEL_BSP_EXPORT_TIMEOUT'] = '10000'
|
|
224
|
+
|
|
225
|
+
client = FiddlerClient(
|
|
226
|
+
api_key="your-api-key",
|
|
227
|
+
application_id="your-app-id"
|
|
228
|
+
)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Default Configuration
|
|
232
|
+
|
|
233
|
+
The SDK uses restrictive defaults to prevent excessive resource usage:
|
|
234
|
+
|
|
235
|
+
- **Span Limits**: 32 events/links/attributes per span, 2048 character attribute length
|
|
236
|
+
- **Batch Processing**: 100 queue size, 1000ms delay, 10 batch size, 5000ms timeout
|
|
237
|
+
- **Sampling**: Always on (100% sampling)
|
|
238
|
+
|
|
239
|
+
## Features
|
|
240
|
+
|
|
241
|
+
### Core Features
|
|
242
|
+
|
|
243
|
+
- **OpenTelemetry Integration**: Full tracing support with configurable span limits
|
|
244
|
+
- **Input Validation**: UUID4 validation for application IDs, URL validation
|
|
245
|
+
- **Flexible Configuration**: Custom span limits, sampling strategies, and batch processing
|
|
246
|
+
- **Resource Management**: Conservative defaults to prevent resource exhaustion
|
|
247
|
+
|
|
248
|
+
### LangGraph Instrumentation
|
|
249
|
+
|
|
250
|
+
- **Automatic Tracing**: Complete workflow tracing with span hierarchy
|
|
251
|
+
- **LLM Context Setting**: Set additional context information for LLM processing via `set_llm_context()`
|
|
252
|
+
- **Conversation Tracking**: Set conversation IDs for multi-turn conversations via `set_conversation_id()`
|
|
253
|
+
- **Message Serialization**: Smart handling of complex message content (lists, dicts)
|
|
254
|
+
- **Attribute Truncation**: Automatic truncation of long attribute values (256 character limit)
|
|
255
|
+
- **Error Handling**: Comprehensive error tracking and status reporting
|
|
256
|
+
|
|
257
|
+
### Monitoring and Observability
|
|
258
|
+
|
|
259
|
+
- **Span Types**: Different span types for chains, tools, retrievers, and LLMs
|
|
260
|
+
- **Agent Tracking**: Automatic agent name and ID generation
|
|
261
|
+
- **Performance Metrics**: Timing, token usage, and model information
|
|
262
|
+
- **Error Context**: Detailed error information with stack traces
|
|
263
|
+
|
|
264
|
+
## Validation and Error Handling
|
|
265
|
+
|
|
266
|
+
The SDK includes comprehensive validation:
|
|
267
|
+
|
|
268
|
+
- **Application ID**: Must be a valid UUID4 string
|
|
269
|
+
- **URL**: Must have valid scheme (http/https) and netloc
|
|
270
|
+
- **Attribute Values**: Automatically truncated to prevent oversized spans
|
|
271
|
+
- **Message Content**: Smart serialization of complex data structures
|
|
272
|
+
|
|
273
|
+
## Performance Considerations
|
|
274
|
+
|
|
275
|
+
- **High-volume applications**: Increase span limits and batch processing parameters
|
|
276
|
+
- **Low-latency requirements**: Decrease batch schedule delay
|
|
277
|
+
- **Memory constraints**: Use restrictive span limits and smaller batch sizes
|
|
278
|
+
- **Debugging**: Enable console tracer and use higher attribute limits
|
|
279
|
+
- **Production**: Use appropriate sampling strategies to control data volume
|
|
280
|
+
|
|
281
|
+
## Requirements
|
|
282
|
+
|
|
283
|
+
- Python 3.10, 3.11, 3.12, or 3.13
|
|
284
|
+
- Dependencies (automatically installed):
|
|
285
|
+
- opentelemetry-api (1.34.1)
|
|
286
|
+
- opentelemetry-sdk (1.34.1)
|
|
287
|
+
- opentelemetry-instrumentation (0.55b1)
|
|
288
|
+
- opentelemetry-exporter-otlp-proto-http (1.34.1)
|
|
289
|
+
- langgraph (0.4.8)
|
|
290
|
+
- langchain (0.3.26)
|
|
291
|
+
- langchain-core (automatically installed with langchain)
|
|
292
|
+
|
|
293
|
+
## Development
|
|
294
|
+
|
|
295
|
+
### Running Tests
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
# Run all tests
|
|
299
|
+
pytest
|
|
300
|
+
|
|
301
|
+
# Run specific test file
|
|
302
|
+
pytest tests/core/test_client.py
|
|
303
|
+
|
|
304
|
+
# Run with coverage
|
|
305
|
+
pytest --cov=fiddler_langgraph
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Code Quality
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Run linting
|
|
312
|
+
flake8 fiddler_langgraph/
|
|
313
|
+
|
|
314
|
+
# Run type checking
|
|
315
|
+
mypy fiddler_langgraph/
|
|
316
|
+
|
|
317
|
+
# Run security checks
|
|
318
|
+
bandit -r fiddler_langgraph/
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## License
|
|
322
|
+
|
|
323
|
+
Apache License 2.0 - see LICENSE file for details
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
fiddler_langgraph/VERSION,sha256=3XWp6pNBthQZiMIOixnA_IWv_9KNRBeeSGn6qm-iOqU,9
|
|
2
|
+
fiddler_langgraph/__init__.py,sha256=cqomWAmuY-2KvwJTvo7c7cecCPoe31pv4vgyBk_E8oQ,315
|
|
3
|
+
fiddler_langgraph/core/__init__.py,sha256=HXPZt8YpmVrvwEEukoWR78LufMKtl7lVjLtcl9UNSoc,42
|
|
4
|
+
fiddler_langgraph/core/attributes.py,sha256=Kj2p03gzuaVWhgd4odm15xMP-FbYSDA5aBi-dvEtgkA,2864
|
|
5
|
+
fiddler_langgraph/core/client.py,sha256=qgDsMI_bBVSV-75tLjnM0of0i464g9KyeUljiccRkIE,13658
|
|
6
|
+
fiddler_langgraph/core/span_processor.py,sha256=ODYmdo0FUYEFbIWS_VaR9L6qHUVvpnuk-RSIhgRxyb0,1164
|
|
7
|
+
fiddler_langgraph/tracing/__init__.py,sha256=Kw8VUB7RDffBq4ss0v6vNQYi4KDQOM0J1elbMrqJpsU,49
|
|
8
|
+
fiddler_langgraph/tracing/callback.py,sha256=r3k-phh462Nf4LFGDmb_PRHEnJo_qNf3PMmPdRXv60Y,31059
|
|
9
|
+
fiddler_langgraph/tracing/instrumentation.py,sha256=LHCYW6asySajbF-sOOi6_6J7UBD6z1Vwp4QjHP9zzt0,10580
|
|
10
|
+
fiddler_langgraph/tracing/jsonl_capture.py,sha256=7Sy0nbxRftV5y64UCovSlm07qXn-EfG3uHpBu9H2ZiU,8174
|
|
11
|
+
fiddler_langgraph/tracing/util.py,sha256=RKMrrmdCXSRJrTIHngdhRsotPLEY_LR1SKnUXAJC40Y,2678
|
|
12
|
+
fiddler_langgraph-0.1.0rc1.dist-info/METADATA,sha256=GURUuwHK2N4jQlW2vGpZhM-UPwOYyJGwrLwcUrI4VH0,10187
|
|
13
|
+
fiddler_langgraph-0.1.0rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
fiddler_langgraph-0.1.0rc1.dist-info/top_level.txt,sha256=hOKdR6_3AkS4dS6EfE9Ii7YrS_hApnyGfY-0v0DV0s4,18
|
|
15
|
+
fiddler_langgraph-0.1.0rc1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fiddler_langgraph
|