Skip to content

Azure function returns tuple #1312

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JaroslawMargasDev
Copy link

  1. Initialize model:
    model = AzureChatOpenAI(
    openai_api_version="",
    azure_deployment="",
    azure_endpoint="",
    openai_api_key="",
    model="",
    validate_base_url=False,
    )

  2. Create Instance of the DeepEvalBaseLLM
    deepEvalModel = GPTModelAzure(model=model)

  3. Create metric
    metric = AnswerRelevancyMetric(model=deepEvalModel, include_reason=True)

  4. Measure
    await metric.a_measure(test_case)

In this case the response returns not a string but tuple (score and Json string) , so trimAndLoadJson() method fails on find() metod because of tuple.

This fix check the instance of the input_string.

Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
evals-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2025 9:09am

@penguine-ip
Copy link
Contributor

Hey @JaroslawMargasDev how is GPTModelAzure implemented? It should just return a string

@JaroslawMargasDev
Copy link
Author

JaroslawMargasDev commented Jan 27, 2025

Hey @JaroslawMargasDev how is GPTModelAzure implemented? It should just return a string

@penguine-ip

GPTModelAzure(model=model) its same as GPTModel(DeepEvalBaseLLM) class:

instead of load_model() which uses a KEY_FILE_HANDLER I have got:
def load_model(self):
if self.should_use_azure_openai():
return self.model

Each initialize_model() in the metric returns native model:
return model, True

As a model I'm using AzureChatOpenAI: https://oai.azure.com
Name: gpt-4o
Model version: 2024-08-06

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