-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from datakind/main
Bringing feature branch up to date
- Loading branch information
Showing
15 changed files
with
1,022 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#version: "3.4" | ||
|
||
services: | ||
promptflow: | ||
#image: mcr.microsoft.com/azureml/promptflow/promptflow-runtime-stable:latest | ||
build: | ||
context: . | ||
dockerfile: ./flows/chainlit-ui-evaluation//Dockerfile | ||
container_name: recipes-ai-promptflow | ||
env_file: | ||
- .env | ||
volumes: | ||
- ./flows:/app | ||
- ./utils:/app/chainlit-ui-evaluation/utils | ||
- ./templates:/app/chainlit-ui-evaluation/templates | ||
- shared-data:/app/chainlit-ui-evaluation/recipes/public | ||
- ./management/skills.py:/app/chainlit-ui-evaluation/recipes/skills.py | ||
- ./ui/chat-chainlit-assistant/app.py:/app/chainlit-ui-evaluation/app.py | ||
volumes: | ||
pgdata2: | ||
shared-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime-stable:latest | ||
|
||
# No need to copy the app code, we mount via docker-compose-dev.yml | ||
|
||
RUN pip3 install --upgrade pip | ||
RUN pip3 install chainlit==1.1.305 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from typing import List | ||
|
||
import numpy as np | ||
from promptflow import log_metric, tool | ||
|
||
|
||
@tool | ||
def aggregate_variants_results(results: List[dict]): | ||
""" | ||
Aggregate the results of multiple variants. | ||
Args: | ||
results (List[dict]): A list of dictionaries containing the results for each variant. | ||
Returns: | ||
dict: A dictionary containing the aggregated results, with the metric names as keys and the aggregated values as values. | ||
""" | ||
aggregate_results = {} | ||
for result in results: | ||
for name, value in result.items(): | ||
if name not in aggregate_results.keys(): | ||
aggregate_results[name] = [] | ||
try: | ||
float_val = float(value) | ||
except Exception: | ||
float_val = np.nan | ||
aggregate_results[name].append(float_val) | ||
|
||
for name, value in aggregate_results.items(): | ||
metric_name = name | ||
aggregate_results[name] = np.nanmean(value) | ||
if "pass_rate" in metric_name: | ||
metric_name = metric_name + "(%)" | ||
aggregate_results[name] = aggregate_results[name] * 100.0 | ||
aggregate_results[name] = round(aggregate_results[name], 2) | ||
log_metric(metric_name, aggregate_results[name]) | ||
|
||
return aggregate_results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/AzureOpenAIConnection.schema.json | ||
name: open_ai_connection | ||
type: azure_open_ai | ||
api_key: "<user-input>" | ||
api_base: "<user-input>" | ||
api_type: "azure" |
Oops, something went wrong.