Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Apr 13, 2024
1 parent 274998b commit ec66691
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
12 changes: 6 additions & 6 deletions python/langsmith/wrappers/_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ def _reduce_choices(choices: List[Choice]) -> dict:
"arguments": "",
}
if chunk.function.name:
message["tool_calls"][index]["function"]["name"] += (
chunk.function.name
)
message["tool_calls"][index]["function"][
"name"
] += chunk.function.name
if chunk.function.arguments:
message["tool_calls"][index]["function"]["arguments"] += (
chunk.function.arguments
)
message["tool_calls"][index]["function"][
"arguments"
] += chunk.function.arguments
return {
"index": choices[0].index,
"finish_reason": next(
Expand Down
14 changes: 10 additions & 4 deletions python/tests/integration_tests/test_context_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ async def the_parent_function():
headers = {}
if span := get_current_run_tree():
headers.update(span.to_headers())
return await client.post("/fake-route", headers=headers)
response = await client.post("/fake-route", headers=headers)
assert response.status_code == 200
return response.json()


@traceable
Expand All @@ -47,7 +49,11 @@ async def the_root_function(foo: str):

@pytest.mark.asyncio
async def test_tracing_fake_server(fake_server):
response = await the_root_function(
langsmith_extra={"metadata": {"some-cool-value": 42}, "tags": ["did-propagate"]}
result = await the_root_function(
"test input",
langsmith_extra={
"metadata": {"some-cool-value": 42},
"tags": ["did-propagate"],
},
)
assert response.status_code == 200
assert result["message"] == "Fake route response"

0 comments on commit ec66691

Please sign in to comment.