mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
Merge pull request #3559 from Intellegam/main
Langfuse integration support for `parent_observation_id` parameter
This commit is contained in:
commit
056913fd70
2 changed files with 9 additions and 3 deletions
|
@ -122,6 +122,7 @@ response = completion(
|
||||||
metadata={
|
metadata={
|
||||||
"generation_name": "ishaan-test-generation", # set langfuse Generation Name
|
"generation_name": "ishaan-test-generation", # set langfuse Generation Name
|
||||||
"generation_id": "gen-id22", # set langfuse Generation ID
|
"generation_id": "gen-id22", # set langfuse Generation ID
|
||||||
|
"parent_observation_id": "obs-id9" # set langfuse Parent Observation ID
|
||||||
"version": "test-generation-version" # set langfuse Generation Version
|
"version": "test-generation-version" # set langfuse Generation Version
|
||||||
"trace_user_id": "user-id2", # set langfuse Trace User ID
|
"trace_user_id": "user-id2", # set langfuse Trace User ID
|
||||||
"session_id": "session-1", # set langfuse Session ID
|
"session_id": "session-1", # set langfuse Session ID
|
||||||
|
@ -190,9 +191,10 @@ The following parameters can be updated on a continuation of a trace by passing
|
||||||
|
|
||||||
#### Generation Specific Parameters
|
#### Generation Specific Parameters
|
||||||
|
|
||||||
* `generation_id` - Identifier for the generation, auto-generated by default
|
* `generation_id` - Identifier for the generation, auto-generated by default
|
||||||
* `generation_name` - Identifier for the generation, auto-generated by default
|
* `generation_name` - Identifier for the generation, auto-generated by default
|
||||||
* `prompt` - Langfuse prompt object used for the generation, defaults to None
|
* `parent_observation_id` - Identifier for the parent observation, defaults to `None`
|
||||||
|
* `prompt` - Langfuse prompt object used for the generation, defaults to `None`
|
||||||
|
|
||||||
Any other key value pairs passed into the metadata not listed in the above spec for a `litellm` completion will be added as a metadata key value pair for the generation.
|
Any other key value pairs passed into the metadata not listed in the above spec for a `litellm` completion will be added as a metadata key value pair for the generation.
|
||||||
|
|
||||||
|
|
|
@ -528,6 +528,10 @@ class LangFuseLogger:
|
||||||
"version": clean_metadata.pop("version", None),
|
"version": clean_metadata.pop("version", None),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parent_observation_id = metadata.get("parent_observation_id", None)
|
||||||
|
if parent_observation_id is not None:
|
||||||
|
generation_params["parent_observation_id"] = parent_observation_id
|
||||||
|
|
||||||
if supports_prompt:
|
if supports_prompt:
|
||||||
user_prompt = clean_metadata.pop("prompt", None)
|
user_prompt = clean_metadata.pop("prompt", None)
|
||||||
if user_prompt is None:
|
if user_prompt is None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue