Mistake in example code for [Tracing FAQ]: run_id = id.traced_runs[0].id
linusschoch opened this issue · comments
In the documentation:
Tracing FAQ/How do I get the run id from a call, there is a mistake in the code (should be cb
instead of id
:
from langchain import chat_models, prompts, callbacks
chain = (
prompts.ChatPromptTemplate.from_template("Say hi to {name}")
| chat_models.ChatAnthropic()
)
with callbacks.collect_runs() as cb:
result = chain.invoke({"name": "Clara"})
run_id = id.traced_runs[0].id
print(run_id)
should be corrected to
from langchain import chat_models, prompts, callbacks
chain = (
prompts.ChatPromptTemplate.from_template("Say hi to {name}")
| chat_models.ChatAnthropic()
)
with callbacks.collect_runs() as cb:
result = chain.invoke({"name": "Clara"})
run_id = cb.traced_runs[0].id
print(run_id)
Great catch! Silly me