Skip to content

Commit e705b4d

Browse files
chore: Add more debug logging for Azure provider detection
1 parent 768d035 commit e705b4d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/langtrace_python_sdk/instrumentation/openai/patch.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,19 @@ def traced_method(
434434
args: List[Any],
435435
kwargs: EmbeddingsCreateKwargs,
436436
) -> Any:
437+
print(f"Debug - Embeddings instance type: {type(instance)}")
438+
print(f"Debug - Embeddings instance dir: {dir(instance)}")
439+
437440
service_provider = SERVICE_PROVIDERS["OPENAI"]
438441
base_url = get_base_url(instance)
439-
print(f"Debug - Base URL: {base_url}") # Debug logging
440-
print(f"Debug - Initial Provider: {service_provider}") # Debug logging
442+
print(f"Debug - Base URL in embeddings: {base_url}")
443+
print(f"Debug - Initial Provider: {service_provider}")
444+
441445
if "perplexity" in base_url:
442446
service_provider = SERVICE_PROVIDERS["PPLX"]
443447
elif "azure" in base_url:
444448
service_provider = SERVICE_PROVIDERS["AZURE"]
445-
print(f"Debug - Azure detected, new provider: {service_provider}") # Debug logging
449+
print(f"Debug - Azure detected, new provider: {service_provider}")
446450
elif "groq" in base_url:
447451
service_provider = SERVICE_PROVIDERS["GROQ"]
448452
elif "x.ai" in base_url:

src/tests/openai/test_embeddings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def mock_send(self, request, **kwargs):
6060
base_url="https://your-resource.azure.openai.com/v1",
6161
)
6262

63+
# Debug prints
64+
print(f"Debug - Azure client type: {type(azure_client)}")
65+
print(f"Debug - Azure client base_url: {azure_client.base_url}")
66+
print(f"Debug - Azure client _client._base_url: {azure_client._client._base_url if hasattr(azure_client, '_client') else 'No _client'}")
67+
6368
# Patch the HTTP client's send method
6469
monkeypatch.setattr(httpx.Client, "send", mock_send)
6570

0 commit comments

Comments
 (0)