- The first is to add metadata directly to Parea’s completion method.
- The second is to add metadata to the trace decorator.
- Finally, for the Python SDK, if your trace has already been created, and you want to add dynamic metadata, you can use the trace_insert helper function.
Completion method
The completion method supports the following metadata fields:trace_name
- default is ‘LLM’end_user_identifier
- This is a string representing any identifier for your end users such as an email address or user id.metadata
- This is a serializable dictionary of key value pairs that you want added to the trace. ex:{'git-hash': '1234abcd'}
tags
- This is a list of strings that you want added to the trace. ex:['tag1', 'tag2']
target
- A string representing the ground truth answer you expect from the LLM
- Python
- Typescript
Trace decorator
The trace decorator supports the same metadata fields as the completion method.name
- default is the function’s nameend_user_identifier
metadata
tags
target
deployment_id
session_id
- A string representing a session id for the completion.
- Python
- Typescript
Trace insert
Sometimes the metadata you want to add to a trace is based on something that happens within the function. In this case you could use thetrace_insert()
helper function to add metadata to the trace.
trace_insert
takes a dictionary of metadata field name to value.
The fields supported by trace_insert are:
trace_name
end_user_identifier
metadata
tags
deployment_id
session_id
- A string representing a session id for the completion.
- Python
- Typescript
The new data will be added to the most recent trace.