Skip to content

Commit

Permalink
adding max_simulation_results for sync call (#34923)
Browse files Browse the repository at this point in the history
* adding max_simulation_results for sync call

* # pylint: skip-file

* # pylint: disable=E0611

* # pylint: disable=E0611
  • Loading branch information
nagkumar91 authored Mar 26, 2024
1 parent ce9bea7 commit 3a4636e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# pylint: disable=E0611

import logging
import pandas as pd

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def calculate_metrics(self) -> Dict:
dict_list = self._get_data_for_pf_by_task_type(metrics)

flow_path = path.join(path.dirname(__file__), "pf_templates", "built_in_metrics", self.task_type)

# pylint: disable=E0611
from promptflow import PFClient
from promptflow.entities import AzureOpenAIConnection, OpenAIConnection

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# pylint: skip-file
import os.path
import json
import pathlib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def _wrap_async(
api_call_retry_sleep_sec: int = 1,
api_call_delay_sec: float = 0,
concurrent_async_task: int = 1,
max_simulation_results: int = 3,
):
if parameters is None:
parameters = []
Expand All @@ -503,6 +504,7 @@ def _wrap_async(
api_call_retry_limit=api_call_retry_limit,
api_call_retry_sleep_sec=api_call_retry_sleep_sec,
api_call_delay_sec=api_call_delay_sec,
max_simulation_results=max_simulation_results,
concurrent_async_task=concurrent_async_task,
)
)
Expand All @@ -517,6 +519,7 @@ def simulate(
api_call_retry_limit: int = 3,
api_call_retry_sleep_sec: int = 1,
api_call_delay_sec: float = 0,
max_simulation_results: int = 3,
):
"""
Simulates a conversation using a predefined template with customizable parameters and control over API behavior.
Expand All @@ -536,6 +539,8 @@ def simulate(
:param api_call_delay_sec: The number of seconds to wait
before making a new API call to simulate conversation delay.
:type api_call_delay_sec: float, optional
:keyword max_simulation_results: The maximum number of simulation results to return. Defaults to 3.
:paramtype max_simulation_results: int, optional
:return: The outcome of the simulated conversations as a list.
:rtype: List[Dict]
"""
Expand All @@ -555,6 +560,7 @@ def simulate(
api_call_retry_limit,
api_call_retry_sleep_sec,
api_call_delay_sec,
max_simulation_results,
concurrent_async_task,
),
)
Expand Down

0 comments on commit 3a4636e

Please sign in to comment.