https://www.boundaryml.com logo
Can't connect with Azure foundry openai configurat...
# help
v
Did you set the api key via the playgrounds api key manager?
There’s a “manage api keys” button on the top right
a
I put them via API KEY manage. I will redo the entire process. I just created an agent from openai-python and they keys seem to work
Will test these new keys and configuration
And will reply back. Thanks for quick response Vaibhav
ok now I get this error gpt-4o-mini
for my openai-python project I just used this
Copy code
AZURE_OPENAI_ENDPOINT=https://myresource-resource.cognitiveservices.azure.com/
AZURE_OPENAI_API_KEY=.....
AZURE_OPENAI_DEPLOYMENT=gpt-4o-mini
AZURE_OPENAI_API_VERSION=2024-12-01-preview
I hope this is enough to see what's wrong. I might be building the base_url wrong
a
does the curl request work?
a
You mean this?
Copy code
curl -X POST 'https://api.openai.com/v1/responses' -H "authorization: Bearer $OPENAI_API_KEY" -H "content-type: application/json" -d "{
  \"model\": \"gpt-5-mini\",
  \"input\": [
    {
      \"role\": \"system\",
      \"content\": [
        {
          \"type\": \"input_text\",
          \"text\": \"Extract from this content:\nVaibhav Gupta\nvbv@boundaryml.com\n\nExperience:\n- Founder at BoundaryML\n- CV Engineer at Google\n- CV Engineer at Microsoft\n\nSkills:\n- Rust\n- C++\n\nAnswer in JSON using this schema:\n{\n  name: string,\n  email: string,\n  experience: string[],\n  skills: string[],\n}\"
        }
      ]
    }
  ]
}"
or making a direct curl request without BAML?
j
your provider says
azure-openai
but the curl shows
openai.com
and
$OPENAI_API_KEY
. You should be able to try the curl command on the command line to diagnose separate from BAML or anything else.
I got azure working the other day and it's basically what you would expect once you get all the values correct.
a
doesn't make sense @Jamie because I have literally used these API keys with https://github.com/AbhimanyuAryan/azure-openai-agent/blob/main/src/azure_openai_agent/agent.py An agent I created with
openai-python
but I will use a curl command to see if make the request or not
Hi @aaronv (BAML) the problem seems to be the way API request is being made by BAML. I used a curl request and it worked fine As you can see. It's basically puts the wrong key while making the request https://cdn.discordapp.com/attachments/1441411696194490509/1442547350169063464/image.png?ex=6925d469&is=692482e9&hm=7d3e53cd586d11736873f74d763dad35a84f8fa10011b27a6652e76d9632b6a3&
and my endpoints and crentials are correct. Also after cleaning all openai related stuff in client BAML. I still see the value in key panel. They shouldn't exist
Copy code
// Learn more about clients at https://docs.boundaryml.com/docs/snippets/clients/overview

// Using the new OpenAI Responses API for enhanced formatting

client<llm> MyAzureClient {
  provider azure-openai
  options {
    base_url "https://xxxx-xxx-xxxx-xxxx.cognitiveservices.azure.com/openai/deployments/gpt-4o-mini/chat/completions"
    api_version "2024-12-01-preview"
    api_key env.AZURE_OPENAI_API_KEY
  }
}


// https://docs.boundaryml.com/docs/snippets/clients/retry
retry_policy Constant {
  max_retries 3
  strategy {
    type constant_delay
    delay_ms 200
  }
}

retry_policy Exponential {
  max_retries 2
  strategy {
    type exponential_backoff
    delay_ms 300
    multiplier 1.5
    max_delay_ms 10000
  }
}
a
I think whats happening is your deployment uses openai responses format but we dont support that for azure yet
a
Whats the authentication one?
And the first dropdown?
a
Authentication Type is Key Auth and Entra ID Auth
First drop down is language
Python/TypeScript/etc...
a
Ok yeah they seemed to have changed this so i need to take a look once im in the office. I think azure openai sdk is the one we support
a
Copy code
python
import os
from openai import AzureOpenAI

client = AzureOpenAI(
    api_version="2024-12-01-preview",
    azure_endpoint="https://xx-xx-xx-resource.cognitiveservices.azure.com/",
    api_key=subscription_key,
)

# OpenAI 
from openai import OpenAI

client = OpenAI(
    base_url=f"{endpoint}",
    api_key=api_key
)

# Azure OpenAI SDK

import os
from openai import AzureOpenAI

client = AzureOpenAI(
    api_version="2024-12-01-preview",
    azure_endpoint="https://xx-xx-xx-resource.cognitiveservices.azure.com/",
    api_key=subscription_key,
)
Please take a look and let me know. I have a product showcase coming up soon and I would like do some evals with BAML for rest of the company. Thanks :==))
a
Yep once i have a solution i can let you know or make a patch
I got it working using openai-generic:
Copy code
client<llm> MyClient {
  provider "openai-generic"
  options {
    // use the API key it indicates in the 'models' sidebar navigation menu, and clicking on the model you want to use
    base_url "https://boundarydev-resource.openai.azure.com/openai/v1/"
    api_key env.AZURE_AI_FOUNDRY_API_KEY
    model "gpt-5-mini" // use the model you actually deployed
  }
}
Use the Openai Completions model, with cURL or OpenAI sdk, and copy the params there
a
I love you. Let me try it the first thing in morning. It’s very late now
@aaronv (BAML) what version of BAML are you using?
I am on 0.214.0
and generator.baml complains
Copy code
Version mismatch: ⚠️⚠️⚠️ BAML GENERATION DISABLED: Generator version (0.213.0) !== the VSCode extension version (0.214.0). Major and minor versions must match.

 Update the 'version' in your BAML generator config to '0.214.0' to match the VSCode extension version. 

See https://docs.boundaryml.com/guide/development/upgrade-baml-versions for upgrade instructions.
You defintely know something that I don't know hahaha
I wrote a simple script to test the keys with openai and they are fine
Copy code
PS D:\Learning\LessonPlan> python .\test.py
ChatCompletionMessage(content='The capital of France is Paris.', refusal=None, role='assistant', annotations=[], audio=None, function_call=None, tool_calls=None)
Copy code
python
import os
from dotenv import load_dotenv
from openai import OpenAI

load_dotenv()

endpoint = os.getenv("ENDPOINT")
model_name = "gpt-4o-mini"
deployment_name = "gpt-4o-mini"

api_key = os.getenv("API_KEY") 

client = OpenAI(
    base_url=f"{endpoint}",
    api_key=api_key,
)

completion = client.chat.completions.create(
    model=deployment_name,
    messages=[
        {
            "role": "user",
            "content": "What is the capital of France?",
        }
    ],
)

print(completion.choices[0].message)
aah ok it's just the name
not the error. I modified the name for client and it's changed
ok fuck it worked
don't bother I am a stupid piece of shit. Very silly mistake
thanks regardless
can't image how stupid it was hahaha. I am too embarassed to tell you
a
what was the issue? We actually take the philosophy that it's not the user -- it means there is something wrong with our developer experience
was the client name not set to the right one?
a
Exactly
2 Views