forked from phoenix/litellm-mirror
(fix +test) langfuse log metadata
This commit is contained in:
parent
6475e0a916
commit
936c27c9ee
2 changed files with 9 additions and 6 deletions
|
@ -36,7 +36,8 @@ class LangFuseLogger:
|
|||
print_verbose(
|
||||
f"Langfuse Logging - Enters logging function for model {kwargs}"
|
||||
)
|
||||
metadata = kwargs["litellm_params"].get("metadata", {})
|
||||
litellm_params = kwargs.get("litellm_params", {})
|
||||
metadata = litellm_params.get("metadata", {})
|
||||
prompt = [kwargs.get('messages')]
|
||||
optional_params = kwargs.get("optional_params", {})
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ def test_langfuse_logging_stream():
|
|||
|
||||
def test_langfuse_logging_custom_generation_name():
|
||||
try:
|
||||
litellm.set_verbose=True
|
||||
response = completion(model="gpt-3.5-turbo",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
|
@ -86,18 +87,19 @@ def test_langfuse_logging_custom_generation_name():
|
|||
}],
|
||||
max_tokens=10,
|
||||
metadata = {
|
||||
"generation_name": "litellm-ishaan-gen", # set langfuse generation name
|
||||
# custom metadata fields
|
||||
"project": "litellm-proxy"
|
||||
"langfuse/foo": "bar",
|
||||
"langsmith/fizz": "buzz",
|
||||
"prompt_hash": "asdf98u0j9131123"
|
||||
}
|
||||
)
|
||||
print(response)
|
||||
except litellm.Timeout as e:
|
||||
pass
|
||||
except Exception as e:
|
||||
pytest.fail(f"An exception occurred - {e}")
|
||||
print(e)
|
||||
|
||||
# test_langfuse_logging_custom_generation_name()
|
||||
test_langfuse_logging_custom_generation_name()
|
||||
|
||||
def test_langfuse_logging_function_calling():
|
||||
function1 = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue