Skip to content

Commit b8da201

Browse files
stainless-app[bot]Vivek Nairclaude
authored
release: 1.2.0 (#357)
* feat(client): support file upload requests * chore(examples): add langgraph math agent example (#360) * chore(project): add settings file for vscode * Fix pytest configuration for GitHub Actions - Remove parallel test execution (-n auto) to prevent resource warnings - Change asyncio_default_fixture_loop_scope from "function" to "session" These minimal changes fix test failures on GitHub Actions runners. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat(examples): add langgraph math agent example * chore: remove vscode settings file * chore: set fixture loop scope to function * chore: update imports and rename example file * chore: Clean up Gentrace init and comments --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> * release: 1.2.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Vivek Nair <vivek@gentrace.ai> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 76c0ada commit b8da201

File tree

10 files changed

+144
-13
lines changed

10 files changed

+144
-13
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.1.0"
2+
".": "1.2.0"
33
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 1.2.0 (2025-07-31)
4+
5+
Full Changelog: [v1.1.0...v1.2.0](https://github.com/gentrace/gentrace-python/compare/v1.1.0...v1.2.0)
6+
7+
### Features
8+
9+
* **client:** support file upload requests ([7dd1eea](https://github.com/gentrace/gentrace-python/commit/7dd1eead01ea49fe486a1bf24ee05897801d549d))
10+
* **otlp:** show partial success issues directly in the client SDK code ([#359](https://github.com/gentrace/gentrace-python/issues/359)) ([76c0ada](https://github.com/gentrace/gentrace-python/commit/76c0ada44160a53bd0f59fb3ae374072b3640c8a))
11+
12+
13+
### Chores
14+
15+
* **examples:** add langgraph math agent example ([#360](https://github.com/gentrace/gentrace-python/issues/360)) ([b2f4d86](https://github.com/gentrace/gentrace-python/commit/b2f4d86f8fe3376a2f3d0e0c962e957f62f1b998))
16+
317
## 1.1.0 (2025-07-24)
418

519
Full Changelog: [v1.0.1...v1.1.0](https://github.com/gentrace/gentrace-python/compare/v1.0.1...v1.1.0)

examples/langchain_simple.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
from langchain_core.output_parsers import StrOutputParser
1313
from openinference.instrumentation.langchain import LangChainInstrumentor
1414

15-
import gentrace
15+
from gentrace import init, interaction
1616

1717
load_dotenv()
1818

1919
# Initialize Gentrace with LangChain instrumentation
20-
gentrace.init(
20+
init(
2121
api_key=os.getenv("GENTRACE_API_KEY"),
2222
base_url=os.getenv("GENTRACE_BASE_URL", "https://api.gentrace.ai"),
2323
otel_setup={"service_name": "langchain-example", "instrumentations": [LangChainInstrumentor()]},
@@ -46,7 +46,7 @@ def main() -> None:
4646
chain = prompt | llm | StrOutputParser()
4747

4848
# Create instrumented function
49-
@gentrace.interaction(pipeline_id=os.getenv("GENTRACE_PIPELINE_ID", ""))
49+
@interaction(pipeline_id=os.getenv("GENTRACE_PIPELINE_ID", ""))
5050
def run_chain() -> str:
5151
result = chain.invoke({"topic": "What is OpenTelemetry?"})
5252
print(f"Response: {result}")

examples/langgraph_simple.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
from typing import Any, Dict
3+
4+
# Set OTEL environment variables first
5+
os.environ['LANGSMITH_OTEL_ENABLED'] = 'true'
6+
os.environ['LANGSMITH_OTEL_ONLY'] = 'true'
7+
os.environ['LANGSMITH_TRACING'] = 'true'
8+
9+
from langgraph.prebuilt import create_react_agent # type: ignore[import]
10+
from langchain_core.tools import tool # type: ignore[import]
11+
12+
from gentrace import init, interaction
13+
14+
init()
15+
16+
@tool
17+
def add(a: int, b: int) -> int:
18+
"""Add two numbers together."""
19+
return a + b
20+
21+
@interaction(name="math-agent-interaction")
22+
def run_math_agent() -> Dict[str, Any]:
23+
math_agent = create_react_agent( # type: ignore[var-annotated]
24+
'openai:gpt-4o',
25+
tools=[add],
26+
name='math_agent'
27+
)
28+
29+
result: Dict[str, Any] = math_agent.invoke({ # type: ignore[attr-defined]
30+
'messages': [{
31+
'role': 'user',
32+
'content': "What's 123 + 456?"
33+
}]
34+
})
35+
36+
return result
37+
38+
if __name__ == "__main__":
39+
result = run_math_agent()
40+
print(result)

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "gentrace-py"
3-
version = "1.1.0"
3+
version = "1.2.0"
44
description = "The official Python library for the gentrace API"
55
dynamic = ["readme"]
66
license = "MIT"
@@ -81,6 +81,7 @@ dev-dependencies = [
8181
"langchain-core>=0.3.68",
8282
"langchain-openai>=0.3.27",
8383
"langchain>=0.3.26",
84+
"langgraph>=0.2.0",
8485
"openinference-instrumentation-langchain>=0.1.46",
8586
"pytest-xdist>=3.6.1",
8687
]

requirements-dev.lock

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
# universal: false
1111

1212
-e file:.
13+
aiohappyeyeballs==2.6.1
14+
# via aiohttp
15+
aiohttp==3.12.15
16+
# via gentrace-py
17+
# via httpx-aiohttp
18+
aiosignal==1.4.0
19+
# via aiohttp
1320
annotated-types==0.6.0
1421
# via pydantic
1522
anthropic==0.52.2
@@ -28,7 +35,10 @@ argcomplete==3.6.2
2835
# via nox
2936
# via pydantic-ai-slim
3037
async-timeout==4.0.3
38+
# via aiohttp
3139
# via langchain
40+
attrs==25.3.0
41+
# via aiohttp
3242
boto3==1.39.8
3343
# via pydantic-ai-slim
3444
botocore==1.39.8
@@ -68,15 +78,18 @@ exceptiongroup==1.2.2
6878
# via anyio
6979
# via pydantic-ai-slim
7080
# via pytest
81+
execnet==2.1.1
82+
# via pytest-xdist
7183
fasta2a==0.2.14
7284
# via pydantic-ai-slim
7385
fastavro==1.11.1
7486
# via cohere
75-
execnet==2.1.1
76-
# via pytest-xdist
7787
filelock==3.12.4
7888
# via huggingface-hub
7989
# via virtualenv
90+
frozenlist==1.7.0
91+
# via aiohttp
92+
# via aiosignal
8093
fsspec==2025.5.1
8194
# via huggingface-hub
8295
google-auth==2.40.2
@@ -103,12 +116,16 @@ httpx==0.28.1
103116
# via gentrace-py
104117
# via google-genai
105118
# via groq
119+
# via httpx-aiohttp
120+
# via langgraph-sdk
106121
# via langsmith
107122
# via mistralai
108123
# via openai
109124
# via pydantic-ai-slim
110125
# via pydantic-graph
111126
# via respx
127+
httpx-aiohttp==0.1.8
128+
# via gentrace-py
112129
httpx-sse==0.4.0
113130
# via cohere
114131
huggingface-hub==0.32.4
@@ -117,6 +134,7 @@ idna==3.4
117134
# via anyio
118135
# via httpx
119136
# via requests
137+
# via yarl
120138
importlib-metadata==7.0.0
121139
# via opentelemetry-api
122140
iniconfig==2.0.0
@@ -137,9 +155,20 @@ langchain-core==0.3.68
137155
# via langchain
138156
# via langchain-openai
139157
# via langchain-text-splitters
158+
# via langgraph
159+
# via langgraph-checkpoint
160+
# via langgraph-prebuilt
140161
langchain-openai==0.3.27
141162
langchain-text-splitters==0.3.8
142163
# via langchain
164+
langgraph==0.6.0
165+
langgraph-checkpoint==2.1.1
166+
# via langgraph
167+
# via langgraph-prebuilt
168+
langgraph-prebuilt==0.6.0
169+
# via langgraph
170+
langgraph-sdk==0.2.0
171+
# via langgraph
143172
langsmith==0.4.4
144173
# via langchain
145174
# via langchain-core
@@ -152,6 +181,9 @@ mdurl==0.1.2
152181
# via markdown-it-py
153182
mistralai==1.8.1
154183
# via pydantic-ai-slim
184+
multidict==6.6.3
185+
# via aiohttp
186+
# via yarl
155187
mypy==1.14.1
156188
mypy-extensions==1.0.0
157189
# via mypy
@@ -219,7 +251,10 @@ opentelemetry-semantic-conventions==0.53b1
219251
# via opentelemetry-instrumentation
220252
# via opentelemetry-sdk
221253
orjson==3.10.18
254+
# via langgraph-sdk
222255
# via langsmith
256+
ormsgpack==1.10.0
257+
# via langgraph-checkpoint
223258
packaging==23.2
224259
# via huggingface-hub
225260
# via langchain-core
@@ -233,6 +268,9 @@ pluggy==1.5.0
233268
# via pytest
234269
prompt-toolkit==3.0.51
235270
# via pydantic-ai-slim
271+
propcache==0.3.2
272+
# via aiohttp
273+
# via yarl
236274
protobuf==5.29.4
237275
# via googleapis-common-protos
238276
# via opentelemetry-proto
@@ -250,6 +288,7 @@ pydantic==2.10.3
250288
# via groq
251289
# via langchain
252290
# via langchain-core
291+
# via langgraph
253292
# via langsmith
254293
# via mistralai
255294
# via openai
@@ -348,6 +387,7 @@ types-requests==2.31.0.6
348387
types-urllib3==1.26.25.14
349388
# via types-requests
350389
typing-extensions==4.12.2
390+
# via aiosignal
351391
# via anthropic
352392
# via anyio
353393
# via cohere
@@ -356,6 +396,7 @@ typing-extensions==4.12.2
356396
# via groq
357397
# via huggingface-hub
358398
# via langchain-core
399+
# via multidict
359400
# via mypy
360401
# via openai
361402
# via openai-agents
@@ -389,6 +430,10 @@ wrapt==1.17.2
389430
# via openinference-instrumentation-openai-agents
390431
# via opentelemetry-instrumentation
391432
# via opentelemetry-processor-baggage
433+
xxhash==3.5.0
434+
# via langgraph
435+
yarl==1.20.1
436+
# via aiohttp
392437
zipp==3.17.0
393438
# via importlib-metadata
394439
zstandard==0.23.0

requirements.lock

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
# universal: false
1111

1212
-e file:.
13+
aiohappyeyeballs==2.6.1
14+
# via aiohttp
15+
aiohttp==3.12.15
16+
# via gentrace-py
17+
# via httpx-aiohttp
18+
aiosignal==1.4.0
19+
# via aiohttp
1320
annotated-types==0.6.0
1421
# via pydantic
1522
anthropic==0.52.2
@@ -26,6 +33,10 @@ anyio==4.9.0
2633
# via starlette
2734
argcomplete==3.6.2
2835
# via pydantic-ai-slim
36+
async-timeout==5.0.1
37+
# via aiohttp
38+
attrs==25.3.0
39+
# via aiohttp
2940
boto3==1.39.8
3041
# via pydantic-ai-slim
3142
botocore==1.39.8
@@ -65,6 +76,9 @@ fastavro==1.11.1
6576
# via cohere
6677
filelock==3.18.0
6778
# via huggingface-hub
79+
frozenlist==1.7.0
80+
# via aiohttp
81+
# via aiosignal
6882
fsspec==2025.7.0
6983
# via huggingface-hub
7084
google-auth==2.40.3
@@ -91,11 +105,14 @@ httpx==0.28.1
91105
# via gentrace-py
92106
# via google-genai
93107
# via groq
108+
# via httpx-aiohttp
94109
# via langsmith
95110
# via mistralai
96111
# via openai
97112
# via pydantic-ai-slim
98113
# via pydantic-graph
114+
httpx-aiohttp==0.1.8
115+
# via gentrace-py
99116
httpx-sse==0.4.0
100117
# via cohere
101118
huggingface-hub==0.32.4
@@ -104,6 +121,7 @@ idna==3.4
104121
# via anyio
105122
# via httpx
106123
# via requests
124+
# via yarl
107125
importlib-metadata==8.6.1
108126
# via opentelemetry-api
109127
jiter==0.9.0
@@ -129,6 +147,9 @@ mdurl==0.1.2
129147
# via markdown-it-py
130148
mistralai==1.8.1
131149
# via pydantic-ai-slim
150+
multidict==6.6.3
151+
# via aiohttp
152+
# via yarl
132153
openai==1.93.0
133154
# via gentrace-py
134155
# via openai-agents
@@ -196,6 +217,9 @@ packaging==24.2
196217
# via opentelemetry-instrumentation
197218
prompt-toolkit==3.0.51
198219
# via pydantic-ai-slim
220+
propcache==0.3.2
221+
# via aiohttp
222+
# via yarl
199223
protobuf==5.29.4
200224
# via googleapis-common-protos
201225
# via opentelemetry-proto
@@ -285,6 +309,7 @@ types-requests==2.31.0.6
285309
types-urllib3==1.26.25.14
286310
# via types-requests
287311
typing-extensions==4.12.2
312+
# via aiosignal
288313
# via anthropic
289314
# via anyio
290315
# via cohere
@@ -293,6 +318,7 @@ typing-extensions==4.12.2
293318
# via groq
294319
# via huggingface-hub
295320
# via langchain-core
321+
# via multidict
296322
# via openai
297323
# via openai-agents
298324
# via openinference-instrumentation-openai
@@ -321,6 +347,8 @@ wrapt==1.17.2
321347
# via openinference-instrumentation-openai-agents
322348
# via opentelemetry-instrumentation
323349
# via opentelemetry-processor-baggage
350+
yarl==1.20.1
351+
# via aiohttp
324352
zipp==3.21.0
325353
# via importlib-metadata
326354
zstandard==0.23.0

src/gentrace/_base_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,10 @@ def _build_request(
532532
is_body_allowed = options.method.lower() != "get"
533533

534534
if is_body_allowed:
535-
kwargs["json"] = json_data if is_given(json_data) else None
535+
if isinstance(json_data, bytes):
536+
kwargs["content"] = json_data
537+
else:
538+
kwargs["json"] = json_data if is_given(json_data) else None
536539
kwargs["files"] = files
537540
else:
538541
headers.pop("Content-Type", None)

0 commit comments

Comments
 (0)