Skip to content
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

FEAT: Adding AzureChatCompletionsTarget #687

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

rlundeen2
Copy link
Contributor

@rlundeen2 rlundeen2 commented Feb 4, 2025

This target supports Azure Foundry deployed models, including Phi-4, DeepSeek-R1, Ministral, Llama 3.1, and more.

Memory updates

  • Also modified memory to update or insert
  • Updating memory to consistently raise exceptions if operations fail

@rlundeen2 rlundeen2 marked this pull request as ready for review February 12, 2025 17:42
# %% [markdown]
# # Azure Chat Completions Target
#
# This will allow you to easily interact with models in [Azure AI Foundry](https://ai.azure.com/), such as DeepSeek R1, Phi-4, Mistral, and LLAMA.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we explain why and how this is different from Azure ML Chat Target and Azure Open AI? I honestly don't fully know either.

Comment on lines -254 to +255
session.add_all(entries)
for entry in entries:
session.merge(entry)
Copy link
Contributor

Choose a reason for hiding this comment

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

Behavior is the same, right? How does it help?

@@ -130,7 +130,7 @@ def to_dict(self):
}

def __str__(self):
if self.scorer_class_identifier:
if self.scorer_class_identifier and self.scorer_class_identifier.get("__type__"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if self.scorer_class_identifier and self.scorer_class_identifier.get("__type__"):
if self.scorer_class_identifier and "__type__" in self.scorer_class_identifier:

nit

logger = logging.getLogger(__name__)


class AzureChatCompletionsTarget(PromptChatTarget):
Copy link
Contributor

Choose a reason for hiding this comment

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

This class needs a docstring. I would love to have the difference between this, AOAI, and AML explained as well. Maybe that should be explained on all of these three 😆

finish_reason = azure_completion.choices[0].finish_reason

# finish_reason should be stop if things were a success
if finish_reason != "stop":
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't there a finish reason like token limit? So it's kind of a partial success?


if scores:
# need to insert the prompt first since it has a primary key constraint
# this will be re-inserted by prompt_normalizer, but that's okay
Copy link
Contributor

Choose a reason for hiding this comment

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

as in, there won't be duplicates, right?

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