Describe the bug
Hi,
I follow the instruction to deploy a gpt-4o-mini model and run the chat.py
https://learn.microsoft.com/en-us/azure/ai-foundry/quickstarts/get-started-code?tabs=linux#build-your-chat-app
But I got following error:
root@localhost:/workspace/Build_a_basic_chat_app_in_Python_using_Azure_AI_Foundry_SDK# python3 chat.py
Traceback (most recent call last):
File "/workspace/Build_a_basic_chat_app_in_Python_using_Azure_AI_Foundry_SDK/chat.py", line 11, in <module>
response = chat.complete(
File "/usr/local/lib/python3.10/dist-packages/azure/ai/inference/_patch.py", line 738, in complete
raise HttpResponseError(response=response)
azure.core.exceptions.HttpResponseError: (None) Invalid URL (POST /v1/chat/completions)
Code: None
Message: Invalid URL (POST /v1/chat/completions)
I've double confirmed the project-connection-string is CORRECT.
This is my chat.py. Please help to check what's wrong. Thanks you!
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
project_connection_string = "MY_CONNECTION_STRING_IS_HERE"
project = AIProjectClient.from_connection_string(
conn_str=project_connection_string, credential=DefaultAzureCredential()
)
chat = project.inference.get_chat_completions_client()
response = chat.complete(
model="gpt-4o-mini",
messages=[
{
"role": "system",
"content": "You are an AI assistant that speaks like a techno punk rocker from 2350. Be cool but not too cool. Ya dig?",
},
{"role": "user", "content": "Hey, can you help me with my taxes? I'm a freelancer."},
],
)
print(response.choices[0].message.content)
Related command
python3 chat.py
Errors
root@localhost:/workspace/Build_a_basic_chat_app_in_Python_using_Azure_AI_Foundry_SDK# python3 chat.py
Traceback (most recent call last):
File "/workspace/Build_a_basic_chat_app_in_Python_using_Azure_AI_Foundry_SDK/chat.py", line 11, in
response = chat.complete(
File "/usr/local/lib/python3.10/dist-packages/azure/ai/inference/_patch.py", line 738, in complete
raise HttpResponseError(response=response)
azure.core.exceptions.HttpResponseError: (None) Invalid URL (POST /v1/chat/completions)
Code: None
Message: Invalid URL (POST /v1/chat/completions)
Issue script & Debug output
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
project_connection_string = "MY_CONNECTION_STRING_IS_HERE"
project = AIProjectClient.from_connection_string(
conn_str=project_connection_string, credential=DefaultAzureCredential()
)
chat = project.inference.get_chat_completions_client()
response = chat.complete(
model="gpt-4o-mini",
messages=[
{
"role": "system",
"content": "You are an AI assistant that speaks like a techno punk rocker from 2350. Be cool but not too cool. Ya dig?",
},
{"role": "user", "content": "Hey, can you help me with my taxes? I'm a freelancer."},
],
)
print(response.choices[0].message.content)
Expected behavior
expected to see the chat completion response
Environment Summary
azure-cli 2.71.0
core 2.71.0
telemetry 1.1.0
Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1
Python location '/usr/bin/python'
Config directory '/root/.azure'
Extensions directory '/root/.azure/cliextensions'
Python (Linux) 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response
Describe the bug
Hi,
I follow the instruction to deploy a gpt-4o-mini model and run the chat.py
https://learn.microsoft.com/en-us/azure/ai-foundry/quickstarts/get-started-code?tabs=linux#build-your-chat-app
But I got following error:
I've double confirmed the project-connection-string is CORRECT.
This is my chat.py. Please help to check what's wrong. Thanks you!
Related command
python3 chat.py
Errors
root@localhost:/workspace/Build_a_basic_chat_app_in_Python_using_Azure_AI_Foundry_SDK# python3 chat.py
Traceback (most recent call last):
File "/workspace/Build_a_basic_chat_app_in_Python_using_Azure_AI_Foundry_SDK/chat.py", line 11, in
response = chat.complete(
File "/usr/local/lib/python3.10/dist-packages/azure/ai/inference/_patch.py", line 738, in complete
raise HttpResponseError(response=response)
azure.core.exceptions.HttpResponseError: (None) Invalid URL (POST /v1/chat/completions)
Code: None
Message: Invalid URL (POST /v1/chat/completions)
Issue script & Debug output
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
project_connection_string = "MY_CONNECTION_STRING_IS_HERE"
project = AIProjectClient.from_connection_string(
conn_str=project_connection_string, credential=DefaultAzureCredential()
)
chat = project.inference.get_chat_completions_client()
response = chat.complete(
model="gpt-4o-mini",
messages=[
{
"role": "system",
"content": "You are an AI assistant that speaks like a techno punk rocker from 2350. Be cool but not too cool. Ya dig?",
},
{"role": "user", "content": "Hey, can you help me with my taxes? I'm a freelancer."},
],
)
print(response.choices[0].message.content)
Expected behavior
expected to see the chat completion response
Environment Summary
azure-cli 2.71.0
core 2.71.0
telemetry 1.1.0
Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1
Python location '/usr/bin/python'
Config directory '/root/.azure'
Extensions directory '/root/.azure/cliextensions'
Python (Linux) 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response