Spaces:
Configuration error
Configuration error
File size: 1,455 Bytes
447ebeb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import unittest
from unittest.mock import patch
from litellm.integrations.arize.arize_phoenix import ArizePhoenixLogger
class TestArizePhoenixConfig(unittest.TestCase):
@patch.dict(
"os.environ",
{
"PHOENIX_API_KEY": "test_api_key",
"PHOENIX_COLLECTOR_HTTP_ENDPOINT": "http://test.endpoint",
},
)
def test_get_arize_phoenix_config_http(self):
# Call the function to get the configuration
config = ArizePhoenixLogger.get_arize_phoenix_config()
# Verify the configuration
self.assertEqual(
config.otlp_auth_headers, "Authorization=Bearer%20test_api_key"
)
self.assertEqual(config.endpoint, "http://test.endpoint")
self.assertEqual(config.protocol, "otlp_http")
@patch.dict(
"os.environ",
{
"PHOENIX_API_KEY": "test_api_key",
"PHOENIX_COLLECTOR_ENDPOINT": "grpc://test.endpoint",
},
)
def test_get_arize_phoenix_config_grpc(self):
# Call the function to get the configuration
config = ArizePhoenixLogger.get_arize_phoenix_config()
# Verify the configuration
self.assertEqual(
config.otlp_auth_headers, "Authorization=Bearer%20test_api_key"
)
self.assertEqual(config.endpoint, "grpc://test.endpoint")
self.assertEqual(config.protocol, "otlp_grpc")
if __name__ == "__main__":
unittest.main()
|