Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added support for AzureAI client service#188

Open
adityasugandhi wants to merge 16 commits intoSylphAI-Inc:mainfrom
adityasugandhi:main
Open

Added support for AzureAI client service#188
adityasugandhi wants to merge 16 commits intoSylphAI-Inc:mainfrom
adityasugandhi:main

Conversation

Copy link
Contributor

adityasugandhi commented Aug 21, 2024 *
edited
Loading

Added Support Azure AI, client serivce #92

Now you can use either OPEN_AI_KEY or you can use Azure identity service to directly authenticate to your end points using credentials

chainyo reacted with eyes emoji
Copy link

hmehta92 commented Aug 27, 2024

@adityasugandhi
It seems that line 183 to 200, is duplicate of 163 to 180. Also, token in line 178 didn't work for me. I used azure_ad_token_provider instead.

fixed azure_ad_token provider in AzureOpenAI
Copy link
Contributor Author

adityasugandhi commented Aug 28, 2024 *
edited
Loading

@hmehta92 I have fixed the azure_ad_token provider call, and line 163 to 180 serves for AzureOpenAI, where line 183 to 200 is for AsyncAzureOpenAI.

Copy link

chainyo commented Sep 6, 2024

Hi, what's the status of this PR? Do you need help @adityasugandhi for anything?

I would like to see this feature implemented asap along with AWS Bedrock as they could serve more companies as they usually go with cloud providers when the other part of the cloud is hosted there.

Copy link
Contributor Author

adityasugandhi commented Sep 6, 2024

@chainyo I am still waiting for the review from the repo owner. @liyin2015

Sure, I will start looking into AWS Bedrock

liyin2015 reviewed Sep 8, 2024
Copy link
Member

liyin2015 left a comment *
edited
Loading

Choose a reason for hiding this comment

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

(1) Please add azure as a optional package in lazy_import
(2) please add a test file in adalflow/tests
(3) add azure in the pyproject.toml as an extra package

@adityasugandhi

liyin2015 reviewed Sep 8, 2024
chat_completion_parser: Callable[[Completion], Any] = None,
input_type: Literal["text", "messages"] = "text",
):
r"""It is recommended to set the OPENAI_API_KEY environment variable instead of passing it as an argument.
Copy link
Member

liyin2015 Sep 8, 2024

Choose a reason for hiding this comment

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

so it does not have it only api_key? why using openai_api_key?

Copy link
Contributor Author

adityasugandhi Sep 8, 2024

Choose a reason for hiding this comment

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

@liyin2015 I have made changes as mentioned in the comments

liyin2015 reviewed Sep 8, 2024
Copy link
Contributor Author

adityasugandhi commented Sep 8, 2024

@liyin2015 I have made changes

githubabby reviewed Sep 12, 2024
log_probs = []
for c in completion.choices:
content = c.logprobs.content
print(content)
Copy link

githubabby Sep 12, 2024

Choose a reason for hiding this comment

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

@adityasugandhi I think you forgot to remove print statement here on line 90.

Copy link

chainyo commented Oct 3, 2024

Hey where are we at with this PR? @adityasugandhi

liyin2015 reviewed Oct 6, 2024
@@ -0,0 +1,450 @@
"""AzureOpenAI ModelClient integration."""

import os
Copy link
Member

liyin2015 Oct 6, 2024 *
edited
Loading

Choose a reason for hiding this comment

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

This feels almost the same as openai client, maybe we should just subclass from openai client and overwrite a few functions. [Will accept for now, but will need a lot more work to simplify]

liyin2015 reviewed Oct 6, 2024


openai = safe_import(OptionalPackages.OPENAI.value[0], OptionalPackages.OPENAI.value[1])
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
Copy link
Member

liyin2015 Oct 6, 2024

Choose a reason for hiding this comment

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

please change this to safe import

liyin2015 approved these changes Oct 6, 2024
Copy link
Member

liyin2015 left a comment

Choose a reason for hiding this comment

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

Approve for now and will test more later and release in the next version

liyin2015 reviewed Oct 6, 2024
from openai.types.chat import ChatCompletionChunk, ChatCompletion
from adalflow.core.model_client import ModelClient
from adalflow.core.types import ModelType, EmbedderOutput, TokenLogProb, CompletionUsage, GeneratorOutput
from adalflow.components.model_client.openai_client import AzureAIClient
Copy link
Member

liyin2015 Oct 6, 2024

Choose a reason for hiding this comment

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

all tests are wrong.

liyin2015 reviewed Oct 6, 2024
Copy link
Member

liyin2015 left a comment

Choose a reason for hiding this comment

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

This pr is nowhere near to be accepted, and will need to take a more serious investigation and tests and code refactor

Copy link
Contributor Author

adityasugandhi commented Oct 7, 2024

This pr is nowhere near to be accepted, and will need to take a more serious investigation and tests and code refactor

Hi @liyin2015 , I have updated the pr and have made fixes as suggested earlier. with test_azure_client.py tested successfully.

adityasugandhi added 2 commits October 7, 2024 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

liyin2015 liyin2015 approved these changes

+1 more reviewer

githubabby githubabby left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants