Skip to content

Update Azure.AI.OpenAI to 2.1.0 and add tests #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 30, 2025
Merged

Conversation

manvkaur
Copy link
Collaborator

@manvkaur manvkaur commented Apr 13, 2025

This pull request introduces several breaking changes, dependency updates, and enhancements to the Azure Functions OpenAI Extension and its Java library. Key updates include renaming properties and classes for better clarity, adding managed identity support, and updating dependencies. Additionally, a new unit test project has been added, and documentation has been updated to reflect these changes.

Breaking Changes and Enhancements:

  • Renamed properties in bindings (model to chatModel and embeddingsModel, connectionName to searchConnectionName and storeConnectionName) and renamed ChatMessage to AssistantMessage. [1] [2] [3] [4] [5] [6]
  • Updated Java library annotations, Assistant and Semantic Search bindings to include new configuration options (e.g., temperature, topP, maxTokens) and replaced EmbeddingsOptions with a List<String> for input in EmbeddingsContext. [1] [2]

New Features:

  • Introduced aiConnectionName for managed identity support in bindings like AssistantPost, EmbeddingsStore, SemanticSearchand TextCompletion. [1] [2]
  • Additional configuration options for AI service connections, including managed identity and fallback to environment variables.
  • Added experimental isReasoningModel property to support reasoning models. [1] [2]

Dependency Updates:

  • Updated Azure.AI.OpenAI to version 2.1.0 and azure-ai-openai to version 1.0.0-beta.16. [1] [2]

Testing and CI Enhancements:

  • Added a new unit test project WebJobsOpenAIUnitTests to the solution and included it in the CI pipeline for build and test coverage. [1] [2]
  • Add Samples Tests for:
    1. Embeddings
    2. Semantic Search
    3. Text Completion
  • Add Unit Tests for:
    1. OpenAI Client Factory
    2. Assistant Service

Documentation Updates:

  • Updated README.md to reflect new requirements (e.g., .NET 8 SDK, Azurite) and detailed configuration options for AI service connections. Added examples for managed identity and configuration sections. [1] [2]

File and Class Renaming:

  • Renamed ChatMessage to AssistantMessage in the Java library, Worker and WebJobs csproj, including corresponding updates to fields and methods. [1] [2] [3] [4]
  • Removed reference to preview package Microsoft.Azure.WebJobs.Script.Abstractions and deleted unused BuiltInFunctionsProvider.cs

Issues Resolved:

  1. Allow configuring properties like Max Token,Top_P etc in Assistant Post #104
  2. https://github.com/Azure/azure-functions-pyfx-planning/issues/395
  3. https://github.com/Azure/azure-functions-pyfx-planning/issues/164
  4. https://github.com/Azure/azure-functions-pyfx-planning/issues/269

Performance impact:

  1. Latency in first client creation as it has moved from start up to binding, later calls can retrieve from cache if exists.

Will add more test coverage in upcoming PRs.

Next PR:

@manvkaur manvkaur changed the title Manvkaur/updateaoai Update Azure AI Open AI major version Apr 13, 2025
@manvkaur manvkaur changed the title Update Azure AI Open AI major version Updated Azure.AI.OpenAI to 2.1.0 and add tests Apr 13, 2025
@manvkaur manvkaur changed the title Updated Azure.AI.OpenAI to 2.1.0 and add tests Update Azure.AI.OpenAI to 2.1.0 and add tests Apr 13, 2025
@manvkaur manvkaur marked this pull request as ready for review April 14, 2025 21:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 135 out of 140 changed files in this pull request and generated no comments.

Files not reviewed (5)
  • OpenAI-Extension.sln: Language not supported
  • java-library/pom.xml: Language not supported
  • samples/assistant/csharp-legacy/AssistantSample.csproj: Language not supported
  • samples/assistant/csharp-ooproc/AssistantSample.csproj: Language not supported
  • samples/assistant/java/extensions.csproj: Language not supported
Comments suppressed due to low confidence (3)

java-library/src/main/java/com/microsoft/azure/functions/openai/annotation/textcompletion/TextCompletion.java:56

  • [nitpick] Consider updating the associated Javadoc to reference 'chatModel' instead of 'model' so that the documentation aligns with the new property name.
String chatModel() default "gpt-3.5-turbo";

java-library/src/main/java/com/microsoft/azure/functions/openai/annotation/embeddings/EmbeddingsContext.java:14

  • Review the change from using EmbeddingsOptions to List for input to ensure that downstream processing is compatible with the new type; verify any related transformation logic has been updated accordingly.
private List<String> input;

java-library/src/main/java/com/microsoft/azure/functions/openai/annotation/assistant/AssistantMessage.java:28

  • [nitpick] Update the Javadoc comment for the constructor to clearly describe the purpose of the 'toolCalls' parameter, ensuring consistency with previous documentation for the renamed property.
public AssistantMessage(String content, String role, String toolCalls) {

@manvkaur manvkaur requested a review from TsuyoshiUshio April 23, 2025 17:18
Copy link
Contributor

@aishwaryabh aishwaryabh left a comment

Choose a reason for hiding this comment

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

Left a few nit comments but looks good overall!

@manvkaur manvkaur requested a review from aishwaryabh April 24, 2025 23:23
@TsuyoshiUshio
Copy link

TsuyoshiUshio commented Apr 25, 2025

Hi @manvkaur

I'd like to understand the context why you changed the name as breaking change.

Renamed properties in bindings (model to chatModel and embeddingsModel, connectionName to searchConnectionName and storeConnectionName) and renamed ChatMessage to AssistantMessage. Updated managed identity support via the aiConnectionName property for Azure OpenAI

I've got the answer from the author.

I wanted to create a base class, AssistantBaseAttribute, to serve as the foundation for AssistantAttribute, SemanticSearchAttribute, and TextCompletionAttribute.

One of the child classes uses two models - ChatModel and EmbeddingsModel, so I aimed to keep them distinct.

Additionally, a new property, AIConnectionName, was introduced for Azure OpenAI connection settings. Therefore, I changed the connection name property for EmbeddingStoreAttribute to storeConnectionName to clearly indicate it is for the embedding store. Similarly, I renamed it to searchConnectionName to specify it is for the search resource connection.

@manvkaur
Copy link
Collaborator Author

Hi @manvkaur

I'd like to understand the context why you changed the name as breaking change.

Renamed properties in bindings (model to chatModel and embeddingsModel, connectionName to searchConnectionName and storeConnectionName) and renamed ChatMessage to AssistantMessage. Updated managed identity support via the aiConnectionName property for Azure OpenAI

I wanted to create a base class, AssistantBaseAttribute, to serve as the foundation for AssistantAttribute, SemanticSearchAttribute, and TextCompletionAttribute.

One of the child classes uses two models - ChatModel and EmbeddingsModel, so I aimed to keep them distinct.

Additionally, a new property, AIConnectionName, was introduced for Azure OpenAI connection settings. Therefore, I changed the connection name property for EmbeddingStoreAttribute to storeConnectionName to clearly indicate it is for the embedding store. Similarly, I renamed another connectionName to searchConnectionName to specify it is for the search resource connection.

@manvkaur manvkaur requested a review from TsuyoshiUshio April 30, 2025 20:01
@manvkaur manvkaur merged commit 9e48d49 into main Apr 30, 2025
8 checks passed
@manvkaur manvkaur deleted the manvkaur/updateaoai branch April 30, 2025 20:50
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.

Allow configuring properties like Max Token,Top_P etc in Assistant Post
4 participants