community: add metadata to chain logging; (#22122)

Hey, I'm Sasha. The SDK engineer from [Comet](https://comet.com).
This PR updates the CometTracer class.
Added metadata to CometTracerr. From now on, both chains and spans will
send it.
This commit is contained in:
sasha 2024-05-24 17:29:40 +02:00 committed by GitHub
parent 7c0459faf2
commit 1c9ceff503
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,9 +66,11 @@ class CometTracer(BaseTracer):
run_dict: Dict[str, Any] = run.dict()
if not run.parent_run_id:
# This is the first run, which maps to a chain
metadata = run_dict["extra"].get("metadata", None)
chain_: "Chain" = self._chain.Chain(
inputs=run_dict["inputs"],
metadata=None,
metadata=metadata,
experiment_info=self._experiment_info.get(),
)
self._chains_map[run.id] = chain_