You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to test you really cool "bia-bob" a bit internally, but so far I just cannot get it to work. And I think it might be due to our internal environment.
when using our internal endpoint & key I can list all our models (gpt's and others), for example: gpt-4o-2024-08-06
...
# that code works fineclient=AzureOpenAI(
api_version=os.environ["AZURE_OPENAI_API_VERSION"],
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
api_key=os.environ["AZURE_OPENAI_API_KEY"],
)
...
later in my notebook I tried: bob.initialize(endpoint="azure", model="gpt-4o-2024-08-06") and also using the endpoint directly, but always get errors. I tried to modify "_utilities.py" because I think our internal endpoint confuses the code because:
get called but we are using gpt-models, but not hosted by open AI. I then leads to: NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
thanks for reaching out! I never tested an azure-endpoint that is not github-models. So this might be indeed buggy. I presume we could make it to work by modifying the correct_endpoint function in src/bia_bob/_utilities.py. Let's see if the AI agrees:
This message was generated by git-bob (version: 0.20.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.
To adapt bia-bob for using Azure-hosted OpenAI models, you might need to modify the generate_response function in src/bia_bob/_utilities.py. Since your endpoint is Azure, ensure that the generate_response_from_azure function is used properly. You can adjust the conditional logic like shown below:
defgenerate_response(chat_history, image, model, system_prompt, user_prompt, vision_system_prompt):
from ._machineryimportContextfrom .endpoints._azureimportgenerate_response_from_azureifContext.endpoint=="azure"and"gpt-"inmodel:
full_response=generate_response_from_azure(
model, system_prompt, user_prompt, chat_history, image,
base_url=Context.endpoint, api_key=Context.api_key,
vision_model=Context.vision_model,
vision_system_prompt=vision_system_prompt
)
# rest of your conditions...returnfull_response
In this modification, it ensures that Azure-based gpt- models trigger generate_response_from_azure specifically using Azure configurations. Make sure other parts of the code correctly handle your Azure credentials, which you seem to have configured already.
ok, the AI gives wrong advice here. And I checked the example here which should actually work for you too. I just tested this on my machine and it works (using github models though):
import os
from bia_bob import bob
bob.initialize(endpoint="https://models.inference.ai.azure.com",
api_key=os.environ.get('AZURE_API_KEY'),
model="gpt-4o")
Would you mind testing this with your url and api key? If it does not work, could you please copy the entire error message here for debugging?
And may I ask what the value of os.environ["AZURE_OPENAI_API_VERSION"] is?
Also from your code snippet on the very top:
# that code works fine
client = AzureOpenAI(
api_version=os.environ["AZURE_OPENAI_API_VERSION"],
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
api_key=os.environ["AZURE_OPENAI_API_KEY"],
)
There are import statments missing. What library are you using for this?
import os
import openai
client = openai.OpenAI(
base_url=os.environ["AZURE_OPENAI_ENDPOINT"],
api_key=os.environ["AZURE_OPENAI_API_KEY"])
print("\n".join([model.id for model in client.models.list().data]))
I use from openai import AzureOpenAI I just did not add to the snippet. All I know is that the endpoint out "infrastructure guys" gave me ends with *.openai.azure.com. How do I check for *.openai.azure.com/api or *.openai.azure.com/v1? (hope that is not a silly question)
Activity
haesleinhuepf commentedon Mar 26, 2025
Hi @sebi06 ,
thanks for reaching out! I never tested an azure-endpoint that is not github-models. So this might be indeed buggy. I presume we could make it to work by modifying the
correct_endpointfunction insrc/bia_bob/_utilities.py. Let's see if the AI agrees:git-bob comment on how to do this.
github-actions commentedon Mar 26, 2025
This message was generated by git-bob (version: 0.20.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.
To adapt bia-bob for using Azure-hosted OpenAI models, you might need to modify the
generate_responsefunction insrc/bia_bob/_utilities.py. Since your endpoint is Azure, ensure that thegenerate_response_from_azurefunction is used properly. You can adjust the conditional logic like shown below:In this modification, it ensures that Azure-based
gpt-models triggergenerate_response_from_azurespecifically using Azure configurations. Make sure other parts of the code correctly handle your Azure credentials, which you seem to have configured already.haesleinhuepf commentedon Mar 26, 2025
Hi @sebi06 ,
ok, the AI gives wrong advice here. And I checked the example here which should actually work for you too. I just tested this on my machine and it works (using github models though):
Would you mind testing this with your url and api key? If it does not work, could you please copy the entire error message here for debugging?
Thanks!
Best,
Robert
sebi06 commentedon Mar 28, 2025
Hi @haesleinhuepf
this step seems to work fine (using our endpoint, which also ends with *.azure.com ) - I see no errors etc.
But when I try:
I get the error:
haesleinhuepf commentedon Mar 28, 2025
Can you please carefully check if
os.environ["AZURE_OPENAI_ENDPOINT"]ends e.g. like this:https://xyz.azure.com/apihttps://xyz.azure.com/v1And may I ask what the value of
os.environ["AZURE_OPENAI_API_VERSION"]is?Also from your code snippet on the very top:
There are import statments missing. What library are you using for this?
Does this work too? (source)
sebi06 commentedon Mar 28, 2025
Hi @haesleinhuepf
I use
from openai import AzureOpenAII just did not add to the snippet. All I know is that the endpoint out "infrastructure guys" gave me ends with*.openai.azure.com. How do I check for*.openai.azure.com/apior*.openai.azure.com/v1? (hope that is not a silly question)This always worked for me:
And your code
does fail with:
haesleinhuepf commentedon Mar 28, 2025
sebi06 commentedon Mar 28, 2025
Good point. I checked and it is:
2024-02-15-previewsebi06 commentedon Apr 3, 2025
Any news or things I can try out?