Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/llmperf/ray_clients/openai_chat_completions_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def llm_request(self, request_config: RequestConfig) -> Dict[str, Any]:
if not address.endswith("/"):
address = address + "/"
address += "chat/completions"
if "azure"in address:
Copy link

@NicolasGrosjeanProbayes NicolasGrosjeanProbayes Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to replace "azure" by "openai.azure.com" because we can use other models (for example Mistral Large) in "ml.azure.com" and we don't want to enter in this bloc of code.

api_version = os.environ.get("OPENAI_API_VERSION")
if not api_version:
raise ValueError("the environment variable OPENAI_API_VERSION must be set for Azure OpenAI service.")
address = f"{address}?api-version={api_version}"
headers = {"api-key": key} # replace with Authorization: Bearer
try:
with requests.post(
address,
Expand Down