Skip to content

Commit

Permalink
Small fixes to accompany braintrustdata/autoevals#27 (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankrgyl authored Nov 10, 2023
1 parent 6d9e166 commit c57e41d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion autoevals
2 changes: 2 additions & 0 deletions py/src/braintrust/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions py/src/braintrust/oai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c57e41d

Please sign in to comment.