Hi all, Is there a way to use Arize with AzureOpenAI that is behind a APIM gateway? when i initiate my model in either langchain/llamaindex, i need to pass extra headers like this: default_headers={"Ocp-Apim-Subscription-Key": <your-subscription-key-here>}. Wondering if there's a similar way to pass these extra headers to Arize as well?
Hi Owen L. - Arize has quite a few OpenAI offerings. Which part of ArizePhoenix are you trying to use? I think all should work with Azure as you desire. If you are trying to use the Arize saas platform and not the OSS library, Arize AX Support can help you out! Thanks for reaching out.
Owen L. Assume you are talking about Arize core platform versus Phoenix OSS? We do propagate values in headers ourselves in both phoenix and arize core, we set it in register_otel OR OTEL setup, so example below is how you might augment your headers on top.
def add_additional_headers(additional_headers: dict) -> None:
# Get the existing headers
existing_headers = os.getenv("OTEL_EXPORTER_OTLP_TRACES_HEADERS", "")
# Format additional headers as a comma-separated string
formatted_additional_headers = ",".join(f"{key}={value}" for key, value in additional_headers.items())
# Combine existing headers with additional headers
if existing_headers:
combined_headers = f"{existing_headers},{formatted_additional_headers}"
else:
combined_headers = formatted_additional_headers
# Set the combined headers as an environment variable
os.environ["OTEL_EXPORTER_OTLP_TRACES_HEADERS"] = combined_headers
# Example usage
#register_otel or OTEL setup
add_additional_headers({
"Ocp-Apim-Subscription-Key": "your_subscription_key_here"
}) 