Skip to content

Commit

Permalink
Quick fix for ragas.py (#165)
Browse files Browse the repository at this point in the history
* small fix for ragas.py

Signed-off-by: aasavari <aasavari.dhananjay.kakne@intel.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: aasavari <aasavari.dhananjay.kakne@intel.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
adkakne and pre-commit-ci[bot] authored Oct 18, 2024
1 parent 70697d1 commit a807b8a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion evals/benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def run_service_test(example, service_type, service, test_suite_config):
deployment_type,
test_suite_config.get("service_ip"),
test_suite_config.get("service_port"),
test_suite_config.get("namespace")
test_suite_config.get("namespace"),
)

base_url = f"http://{svc_ip}:{port}"
Expand Down
2 changes: 2 additions & 0 deletions evals/benchmark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def write_json(data, filename):
logging.error(f"Failed to write {filename}: {e}")
return False


from kubernetes import client, config


def get_service_cluster_ip(service_name, namespace="default"):
# Load the Kubernetes configuration
config.load_kube_config() # or use config.load_incluster_config() if running inside a Kubernetes pod
Expand Down
2 changes: 1 addition & 1 deletion evals/metrics/ragas/ragas.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def measure(self, test_case: Dict):
else:
if metric == "AnswerRelevancy" and self.embeddings is None:
raise ValueError("AnswerRelevancy metric need provide embeddings model.")
tmp_metrics.append(self.metrics_instance[metric])
tmp_metrics.append(self.metrics_instances[metric])
self.metrics = tmp_metrics
else:
self.metrics = list(self.metric_instances.values())
Expand Down

0 comments on commit a807b8a

Please sign in to comment.