Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nqn committed May 23, 2024
1 parent 26f7880 commit c8336d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions log10/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def last_completion_url(self):
if last_completion_response_var.get() is None:
return None
response = last_completion_response_var.get()
return url + "/app/" + response["organizationSlug"] + "/completions/" + response["completionID"]
return f'{url}/app/{response["organizationSlug"]}/completions/{response["completionID"]}'


@contextmanager
Expand Down Expand Up @@ -196,8 +196,6 @@ async def log_async(completion_url, log_row):
res = post_request(_url, log_row)
except Exception as e:
logging.warn(f"LOG10: failed to log: {e}. Skipping")
# Print the exception tracompletion_urlceback
traceback.print_tb(e.__traceback__)
return None

elif target_service == "bigquery":
Expand All @@ -206,8 +204,6 @@ async def log_async(completion_url, log_row):

except Exception as e:
logging.warn(f"LOG10: failed to log: {e}. Skipping")
# Print the exception traceback
traceback.print_tb(e.__traceback__)
return None

return completionID
Expand Down
5 changes: 3 additions & 2 deletions tests/test_context_managers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import contextvars
import uuid

import pytest

session_id_var = contextvars.ContextVar("session_id", default=str(uuid.uuid4()))

Expand Down Expand Up @@ -52,7 +52,7 @@ def test_nested_contexts():

assert simulated_llm_call() == before_outer_session


@pytest.mark.asyncio
async def test_nested_async_contexts():
print("")
before_outer_session = await simulated_llm_acall()
Expand All @@ -74,6 +74,7 @@ async def test_nested_async_contexts():


# Test overlapping async context managers
@pytest.mark.asyncio
async def test_overlapping_async_contexts():
# Run two async context managers in parallel
# The second one should not overwrite the session ID of the first one
Expand Down

0 comments on commit c8336d6

Please sign in to comment.