You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/langsmith/add-metadata-tags.mdx
+34-35Lines changed: 34 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,18 +9,18 @@ Tags are strings that can be used to categorize or label a trace. Metadata is a
9
9
10
10
Both are useful for associating additional information with a trace, such as the environment in which it was executed, the user who initiated it, or an internal correlation ID. For more information on tags and metadata, see the [Concepts](/langsmith/observability-concepts#tags) page. For information on how to query traces and runs by metadata and tags, see the [Filter traces in the application](/langsmith/filter-traces-in-application) page.
11
11
12
-
<Tabs>
13
-
<Tabtitle="Python">
14
-
```python
15
-
import openai
16
-
import langsmith as ls
17
-
from langsmith.wrappers import wrap_openai
12
+
<CodeGroup>
18
13
19
-
client = openai.Client()
20
-
messages = [
21
-
{"role": "system", "content": "You are a helpful assistant."},
22
-
{"role": "user", "content": "Hello!"}
23
-
]
14
+
```python Python
15
+
import openai
16
+
import langsmith as ls
17
+
from langsmith.wrappers import wrap_openai
18
+
19
+
client = openai.Client()
20
+
messages = [
21
+
{"role": "system", "content": "You are a helpful assistant."},
22
+
{"role": "user", "content": "Hello!"}
23
+
]
24
24
25
25
# You can set metadata & tags **statically** when decorating a function
26
26
# Use the @traceable decorator with tags and metadata
@@ -65,25 +65,24 @@ Both are useful for associating additional information with a trace, such as the
65
65
rt.metadata["some-conditional-key"] ="some-val"
66
66
rt.end(outputs={"output": chat_completion})
67
67
68
-
# You can use the same techniques with the wrapped client
0 commit comments