Skip to content

azure-openai provider does not work as exepected #133

@shivashanmugam

Description

@shivashanmugam

Scenario

.env file

OPEN_AI_END_POINT=https://azlinux-chatbot-2025.openai.azure.com/
OPEN_AI_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPEN_AI_API_VERSION=2025-03-01-preview

The log analysis bot code example

import logging
import os

logging.basicConfig(level=logging.INFO)

from dotenv import load_dotenv

load_dotenv()

from microbots import LogAnalysisBot

my_bot = LogAnalysisBot(
    model="azure-openai/gpt-5-swe-agent",
    folder_to_mount="code",
)

result = my_bot.run(
    file_name="code/build.log",
    timeout_in_seconds=600,
)
print(result.result)

When running the above log_analysis_bot.py it is unable to identify the service

(.venv) sikannan@sivak:/mnt/c/Users/sikannan/codeBase/microbots-examples$ python3 log_analysis_bot.py
INFO:microbots.environment.local_docker.LocalDockerEnvironment:🗂️  Created working directory at /home/sikannan/MICROBOTS_WORKDIR_5702da3d
INFO:microbots.environment.local_docker.LocalDockerEnvironment:📦 Volume mapping: /mnt/c/Users/sikannan/codeBase/microbots-examples/code → /ro/code
INFO:microbots.environment.local_docker.LocalDockerEnvironment:🚀 Started container 620be0aa8036 with image kavyasree261002/shell_server:latest on host port 44089
INFO:microbots.environment.local_docker.LocalDockerEnvironment:🔒 Set up overlay mount for read-only directory at /workdir/code
INFO:microbots.environment.local_docker.LocalDockerEnvironment:✅ Successfully copied /mnt/c/Users/sikannan/codeBase/microbots-examples/code/build.log to container:/var/log
INFO:httpx:HTTP Request: POST https://azlinux-chatbot-2025.openai.azure.com/responses "HTTP/1.1 404 Resource Not Found"
Traceback (most recent call last):
  File "/mnt/c/Users/sikannan/codeBase/microbots-examples/log_analysis_bot.py", line 17, in <module>
    result = my_bot.run(
             ^^^^^^^^^^^

Root cause identified and suggested fix

In line number 47 of src/microbots/llm/openai_api.py

# Non-Azure users with a plain API key
self.ai_client = OpenAI(
base_url=endpoint,
api_key=api_key,
)

has to be changed as below

# Azure users with a plain API key
            self.ai_client = AzureOpenAI(
                azure_endpoint=endpoint,
                api_key=api_key,
                api_version=api_version,
            )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions