add tests

This commit is contained in:
hughcrt 2024-06-13 15:10:24 -03:00
parent efffa37466
commit 89cee153eb
2 changed files with 7 additions and 10 deletions

View file

@ -110,7 +110,7 @@ class LunaryLogger:
litellm_params = kwargs.get("litellm_params", {}) litellm_params = kwargs.get("litellm_params", {})
optional_params = kwargs.get("optional_params", {}) optional_params = kwargs.get("optional_params", {})
metadata = litellm_params.get("metadata", {}) metadata = litellm_params.get("metadata", {}) or {}
if optional_params: if optional_params:
extra = {**extra, **optional_params} extra = {**extra, **optional_params}

View file

@ -24,8 +24,7 @@ def test_lunary_logging():
except Exception as e: except Exception as e:
print(e) print(e)
test_lunary_logging()
# test_lunary_logging()
def test_lunary_template(): def test_lunary_template():
@ -38,8 +37,7 @@ def test_lunary_template():
except Exception as e: except Exception as e:
print(e) print(e)
test_lunary_template()
# test_lunary_template()
def test_lunary_logging_with_metadata(): def test_lunary_logging_with_metadata():
@ -52,16 +50,16 @@ def test_lunary_logging_with_metadata():
metadata={ metadata={
"run_name": "litellmRUN", "run_name": "litellmRUN",
"project_name": "litellm-completion", "project_name": "litellm-completion",
"tags": ["tag1", "tag2"]
}, },
) )
print(response) print(response)
except Exception as e: except Exception as e:
print(e) print(e)
#test_lunary_logging_with_metadata() test_lunary_logging_with_metadata()
def test_lunary_with_tools(): def test_lunary_with_tools():
import litellm import litellm
messages = [{"role": "user", "content": "What's the weather like in San Francisco, Tokyo, and Paris?"}] messages = [{"role": "user", "content": "What's the weather like in San Francisco, Tokyo, and Paris?"}]
@ -97,7 +95,7 @@ def test_lunary_with_tools():
print("\nLLM Response:\n", response.choices[0].message) print("\nLLM Response:\n", response.choices[0].message)
#test_lunary_with_tools() test_lunary_with_tools()
def test_lunary_logging_with_streaming_and_metadata(): def test_lunary_logging_with_streaming_and_metadata():
try: try:
@ -117,5 +115,4 @@ def test_lunary_logging_with_streaming_and_metadata():
except Exception as e: except Exception as e:
print(e) print(e)
test_lunary_logging_with_streaming_and_metadata()
# test_lunary_logging_with_streaming_and_metadata()