Skip to content

Add AzureBaseLM — Azure OpenAI Responses API adapter#149

Open
alfredjimmy-redbus wants to merge 3 commits intoredbus-labs:mainfrom
alfredjimmy-redbus:feature/azure-responses-api-adapter
Open

Add AzureBaseLM — Azure OpenAI Responses API adapter#149
alfredjimmy-redbus wants to merge 3 commits intoredbus-labs:mainfrom
alfredjimmy-redbus:feature/azure-responses-api-adapter

Conversation

@alfredjimmy-redbus
Copy link

Implements a new BaseLlm adapter for Azure OpenAI using the Responses API (POST /responses) instead of Chat Completions. Maps ADK LlmRequest / LlmResponse to the Responses API shape (input, instructions, tools, output[]) and supports SSE streaming and function calling.

What’s included

  • New AzureBaseLM in core/src/main/java/com/google/adk/models/AzureBaseLM.java
  • Endpoint + API key from env: AZURE_MODEL_ENDPOINT, AZURE_OPENAI_API_KEY
  • Model name passed via constructor (e.g. gpt-5-pro); sent as model in the request body
  • temperature only when explicitly set in config (avoids errors on reasoning models)
  • Treats "error": null in JSON as success (no false error path)
  • Optional debug logging for full response JSON

Testing

  • Model: gpt-5-pro on Azure (Responses endpoint)

Configuration (example)

export AZURE_MODEL_ENDPOINT="url"
export AZURE_OPENAI_API_KEY="<key>"

@alfredjimmy-redbus alfredjimmy-redbus marked this pull request as draft March 20, 2026 13:01
@alfredjimmy-redbus alfredjimmy-redbus marked this pull request as ready for review March 20, 2026 13:06
* @see <a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/responses">Azure
* OpenAI Responses API documentation</a>
*/
public class AzureBaseLM extends BaseLlm {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did we check REDBUSADG?
Is this new file required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants