langchain-ai / langsmith-sdk

LangSmith Client SDK Implementations
https://smith.langchain.com/
MIT License
385 stars 71 forks source link

Issue: how to let LangSmith only trace certain calls (toggle on / off for specific function calls) #824

Closed 3kywa1ke2 closed 3 months ago

3kywa1ke2 commented 3 months ago

Issue you'd like to raise.

Hi,

I saw the documents that says using the traceable decorator can toggle on and off the tracing for functions.

When I testing my application, it still traces all function calls regardless whether the decorator is added or not.

Is there a way that can make langsmith only trace a certain function, instead of tracing all functions?

Thank you!

Suggestion:

No response

hinthornw commented 3 months ago

You can toggle whole traces like this:

with langsmith.tracing_context(enabled={True|False}):
     ...

disabling a specific run within a larger trace isn't well-supported though

hinthornw commented 3 months ago

Feel free to re-open if this doesn't answer your question