Skip to content

Commit 5b8bf3d

Browse files
authored
Update index.mdx
convert to chain
1 parent 53fad65 commit 5b8bf3d

File tree

1 file changed

+3
-2
lines changed
  • docs/platforms/python/integrations/langchain

1 file changed

+3
-2
lines changed

docs/platforms/python/integrations/langchain/index.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ import sentry_sdk
8181
sentry_sdk.init(...) # same as above
8282

8383
llm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0, api_key="bad API key")
84-
with sentry_sdk.start_transaction(op="ai-inference", name="The result of the AI inference"):
85-
response = llm.invoke([("system", "What is the capital of France?")])
84+
with sentry_sdk.start_transaction(op="ai-inference", name="The result of the AI inference"):
85+
chain = (llm | StrOutputParser()).with_config({"run_name": "test-run"})
86+
response = chain.invoke([("system", "What is the capital of France?")])
8687
print(response)
8788
```
8889

0 commit comments

Comments
 (0)