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(
|
print_verbose(
|
||||||
f"Langfuse Logging - Enters logging function for model {kwargs}"
|
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')]
|
prompt = [kwargs.get('messages')]
|
||||||
optional_params = kwargs.get("optional_params", {})
|
optional_params = kwargs.get("optional_params", {})
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ def test_langfuse_logging_stream():
|
||||||
|
|
||||||
def test_langfuse_logging_custom_generation_name():
|
def test_langfuse_logging_custom_generation_name():
|
||||||
try:
|
try:
|
||||||
|
litellm.set_verbose=True
|
||||||
response = completion(model="gpt-3.5-turbo",
|
response = completion(model="gpt-3.5-turbo",
|
||||||
messages=[{
|
messages=[{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
|
@ -86,18 +87,19 @@ def test_langfuse_logging_custom_generation_name():
|
||||||
}],
|
}],
|
||||||
max_tokens=10,
|
max_tokens=10,
|
||||||
metadata = {
|
metadata = {
|
||||||
"generation_name": "litellm-ishaan-gen", # set langfuse generation name
|
"langfuse/foo": "bar",
|
||||||
# custom metadata fields
|
"langsmith/fizz": "buzz",
|
||||||
"project": "litellm-proxy"
|
"prompt_hash": "asdf98u0j9131123"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
print(response)
|
print(response)
|
||||||
except litellm.Timeout as e:
|
except litellm.Timeout as e:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
pytest.fail(f"An exception occurred - {e}")
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
# test_langfuse_logging_custom_generation_name()
|
test_langfuse_logging_custom_generation_name()
|
||||||
|
|
||||||
def test_langfuse_logging_function_calling():
|
def test_langfuse_logging_function_calling():
|
||||||
function1 = [
|
function1 = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue