From c57e41d3e9a003cdc90db2f03bf3d15662fb00e4 Mon Sep 17 00:00:00 2001 From: Ankur Goyal Date: Thu, 9 Nov 2023 18:03:29 -0800 Subject: [PATCH] Small fixes to accompany https://github.com/braintrustdata/autoevals/pull/27 (#37) --- autoevals | 2 +- py/src/braintrust/logger.py | 2 ++ py/src/braintrust/oai.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/autoevals b/autoevals index 618ffa77..bb24b8a2 160000 --- a/autoevals +++ b/autoevals @@ -1 +1 @@ -Subproject commit 618ffa7772f216013aa0e5966f4013e8e187ef25 +Subproject commit bb24b8a2d775a776d83c12849689a55d4bcab9e9 diff --git a/py/src/braintrust/logger.py b/py/src/braintrust/logger.py index f90fade4..4b237a9b 100644 --- a/py/src/braintrust/logger.py +++ b/py/src/braintrust/logger.py @@ -105,6 +105,7 @@ def __exit__(self): pass +# DEVNOTE: This is copied into autoevals/py/autoevals/util.py class _NoopSpan(Span): """A fake implementation of the Span API which does nothing. This can be used as the default span.""" @@ -633,6 +634,7 @@ def login(api_url=None, api_key=None, org_name=None, disable_cache=False, force_ os.makedirs(CACHE_PATH, exist_ok=True) + conn = None if api_key is not None: resp = requests.post(_urljoin(_state.api_url, "/api/apikey/login"), json={"token": api_key}) if not resp.ok: diff --git a/py/src/braintrust/oai.py b/py/src/braintrust/oai.py index 68921e90..67986ff8 100644 --- a/py/src/braintrust/oai.py +++ b/py/src/braintrust/oai.py @@ -55,7 +55,7 @@ def gen(): "prompt_tokens": log_response["usage"]["prompt_tokens"], "completion_tokens": log_response["usage"]["completion_tokens"], }, - output=log_response["choices"][0], + output=log_response["choices"], ) return raw_response finally: @@ -101,7 +101,7 @@ async def gen(): "prompt_tokens": log_response["usage"]["prompt_tokens"], "completion_tokens": log_response["usage"]["completion_tokens"], }, - output=log_response["choices"][0], + output=log_response["choices"], ) return raw_response finally: