Marc
Marc•13mo ago

more on tags metadata

>> more on tags/metadata
21 Replies
Marc
Marc•13mo ago
@Luke Skywalker what's your use case for metadata? would tags or metadata on chains/agents be helpful? From Langchain Base Chain
tags: Optional[List[str]] = None
"""Optional list of tags associated with the chain. Defaults to None.
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a chain with its use case.
"""
metadata: Optional[Dict[str, Any]] = None
"""Optional metadata associated with the chain. Defaults to None.
This metadata will be associated with each call to this chain,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a chain with its use case.
"""
tags: Optional[List[str]] = None
"""Optional list of tags associated with the chain. Defaults to None.
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a chain with its use case.
"""
metadata: Optional[Dict[str, Any]] = None
"""Optional metadata associated with the chain. Defaults to None.
This metadata will be associated with each call to this chain,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a chain with its use case.
"""
Luke Skywalker
Luke Skywalker•13mo ago
Use case is person identification and personal data extraction from document datasets. I put tags on chain already.
extracted_datapoint = extract_datapoint_chain.run(
query_extract,
tags=[
extract_model,
"extract_data_default",
retrieved_metadatas_filtered[single_doc_index]["title"],
f"relevance_distance={distance_array_filtered[single_doc_index]}",
# single_doc["metadata"]["title"],
property_name,
f"{firstname} {lastname}'s {property_details['title']}",
],
callbacks=[langfuse_handler],
)
extracted_datapoint = extract_datapoint_chain.run(
query_extract,
tags=[
extract_model,
"extract_data_default",
retrieved_metadatas_filtered[single_doc_index]["title"],
f"relevance_distance={distance_array_filtered[single_doc_index]}",
# single_doc["metadata"]["title"],
property_name,
f"{firstname} {lastname}'s {property_details['title']}",
],
callbacks=[langfuse_handler],
)
Marc
Marc•13mo ago
if the tags show up in metadata, would this be helpful? (langfuse) metadata
Luke Skywalker
Luke Skywalker•13mo ago
well htey do, but I would love to be able to filter through them in the ui.
Luke Skywalker
Luke Skywalker•13mo ago
No description
Marc
Marc•13mo ago
basically tags contains xyz makes sense not P0 right now but might get to it over the next days
Marc
Marc•13mo ago
can you raise an issue for this? https://github.com/langfuse/langfuse/issues
GitHub
Issues · langfuse/langfuse
Open source observability and analytics for LLM applications - Issues · langfuse/langfuse
Luke Skywalker
Luke Skywalker•13mo ago
for adding metadata to new spans?
Marc
Marc•13mo ago
Oh got it Have you tried the langchain metadata instead of the tags? metadata: Optional[Dict[str, Any]] = None """Optional metadata associated with the chain. Defaults to None. This metadata will be associated with each call to this chain, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case.
Luke Skywalker
Luke Skywalker•13mo ago
GitHub
feat: Add metadata to manually created spans / observations · Issue...
Describe the feature you'd like to request Would love to be able to set metadata fields on manually created spans: Describe the solution you'd like to see langfusehandler.setNextSpan(next...
Luke Skywalker
Luke Skywalker•13mo ago
ui no, lets see
Marc
Marc•13mo ago
do you use langchain metadata already?
Marc
Marc•13mo ago
the callback handler should merge tags and metadata into metadata in langfuse https://github.com/langfuse/langfuse-python/blob/752c1937006d3a5cfef93b21617d9164bbc825db/langfuse/callback.py#L545
GitHub
langfuse-python/langfuse/callback.py at 752c1937006d3a5cfef93b21617...
Langfuse Python SDK. Contribute to langfuse/langfuse-python development by creating an account on GitHub.
Luke Skywalker
Luke Skywalker•13mo ago
nope only tags.
extracted_datapoint = extract_datapoint_chain.run(
query_extract,
metadata={"foo": "bar"},
callbacks=[langfuse_handler],
)
extracted_datapoint = extract_datapoint_chain.run(
query_extract,
metadata={"foo": "bar"},
callbacks=[langfuse_handler],
)
Like this?
Marc
Marc•13mo ago
and then you can use the filter in the Langfuse UI to select by e.g. extract_model = "extract_data_default"