Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a7758b5
fix(litellm): Avoid double span exits when streaming
alexander-alderman-webb Apr 1, 2026
3f761e9
simplify
alexander-alderman-webb Apr 1, 2026
1f94674
test cleanup
alexander-alderman-webb Apr 1, 2026
c31472c
docs
alexander-alderman-webb Apr 1, 2026
50d0b1f
use underscore
alexander-alderman-webb Apr 2, 2026
edd8a90
test(litellm): Replace mocks with httpx types in nonstreaming tests
alexander-alderman-webb Apr 2, 2026
ec3d128
add fixture
alexander-alderman-webb Apr 2, 2026
a4b9b3a
more mocks
alexander-alderman-webb Apr 7, 2026
9ae99be
update tox
alexander-alderman-webb Apr 7, 2026
6f3c247
cleanup
alexander-alderman-webb Apr 10, 2026
ecd3718
Merge branch 'master' into webb/litellm/close-spans
alexander-alderman-webb Apr 10, 2026
0536025
re-run tox
alexander-alderman-webb Apr 10, 2026
62c32cb
Merge branch 'master' into webb/litellm/close-spans
alexander-alderman-webb Apr 10, 2026
f352bba
Merge branch 'webb/litellm/close-spans' into webb/litellm/remove-mocks
alexander-alderman-webb Apr 10, 2026
6eb17c9
reset all executor references
alexander-alderman-webb Apr 10, 2026
1b28574
merge
alexander-alderman-webb Apr 10, 2026
ce5ce74
delete span when finished
alexander-alderman-webb Apr 13, 2026
8435f36
safe exit pattern
alexander-alderman-webb Apr 13, 2026
392eb17
Merge branch 'webb/litellm/close-spans' into webb/litellm/remove-mocks
alexander-alderman-webb Apr 13, 2026
5dc9bbe
update tox.ini again
alexander-alderman-webb Apr 13, 2026
0882066
Merge branch 'master' into webb/litellm/close-spans
alexander-alderman-webb Apr 13, 2026
ee4d55c
tox run
alexander-alderman-webb Apr 13, 2026
5fd4efe
merge master
alexander-alderman-webb Apr 13, 2026
36fd0d5
fix merge
alexander-alderman-webb Apr 13, 2026
e0705fe
reformat
alexander-alderman-webb Apr 13, 2026
ec7b1f4
reformat
alexander-alderman-webb Apr 13, 2026
672ca81
add test cleanup fixture
alexander-alderman-webb Apr 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@
},
"litellm": {
"package": "litellm",
"deps": {
"*": ["anthropic", "google-genai"],
},
},
"litestar": {
"package": "litestar",
Expand Down
62 changes: 31 additions & 31 deletions scripts/populate_tox/package_dependencies.jsonl

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions scripts/populate_tox/releases.jsonl

Large diffs are not rendered by default.

91 changes: 90 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
openai = None


try:
import anthropic
except ImportError:
anthropic = None


try:
import google
except ImportError:
google = None


from tests import _warning_recorder, _warning_recorder_mgr

from typing import TYPE_CHECKING
Expand Down Expand Up @@ -1097,7 +1109,12 @@
)

if serialize_pydantic:
response_content = json.dumps(response_content.model_dump()).encode("utf-8")
response_content = json.dumps(
response_content.model_dump(
by_alias=True,
exclude_none=True,
)
).encode("utf-8")

response = HttpxResponse(
200,
Expand Down Expand Up @@ -1224,6 +1241,30 @@
]


@pytest.fixture
def nonstreaming_chat_completions_model_response():
return openai.types.chat.ChatCompletion(
id="chatcmpl-test",
choices=[
openai.types.chat.chat_completion.Choice(
index=0,
finish_reason="stop",
message=openai.types.chat.ChatCompletionMessage(
role="assistant", content="Test response"
),
)
],
created=1234567890,
model="gpt-3.5-turbo",
object="chat.completion",
usage=openai.types.CompletionUsage(
prompt_tokens=10,
completion_tokens=20,
total_tokens=30,
),
)


@pytest.fixture
def nonstreaming_responses_model_response():
return openai.types.responses.Response(
Expand Down Expand Up @@ -1263,6 +1304,54 @@
)


@pytest.fixture
def nonstreaming_anthropic_model_response():
return anthropic.types.Message(
id="msg_123",
type="message",
role="assistant",
model="claude-3-opus-20240229",
content=[
anthropic.types.TextBlock(
type="text",
text="Hello, how can I help you?",
)
],
stop_reason="end_turn",
stop_sequence=None,
usage=anthropic.types.Usage(
input_tokens=10,
output_tokens=20,
),
)


@pytest.fixture
def nonstreaming_google_genai_model_response():
return google.genai.types.GenerateContentResponse(
response_id="resp_123",
candidates=[
google.genai.types.Candidate(
content=google.genai.types.Content(
role="model",
parts=[
google.genai.types.Part(
text="Hello, how can I help you?",
)
],
),
finish_reason="STOP",
)
],
model_version="gemini/gemini-pro",
usage_metadata=google.genai.types.GenerateContentResponseUsageMetadata(
prompt_token_count=10,
candidates_token_count=20,
total_token_count=30,
),

Check failure on line 1351 in tests/conftest.py

View check run for this annotation

@sentry/warden / warden: code-review

Missing import causes AttributeError when accessing google.genai.types

The conftest.py imports only `google` at line 65, but the fixture at line 1331 accesses `google.genai.types.*`. In Python, `import google` does not load the submodule `google.genai` - namespace packages require explicit submodule imports. When `nonstreaming_google_genai_model_response` is called, it will raise `AttributeError: module 'google' has no attribute 'genai'`.
)

Check warning on line 1352 in tests/conftest.py

View check run for this annotation

@sentry/warden / warden: find-bugs

Import of `google` namespace does not guarantee `google.genai` availability

The import at line 65 (`import google`) will succeed if any Google namespace package is installed (e.g., `google-cloud-storage`, `google-api-core`), but the `google.genai` submodule will only exist if `google-genai` is specifically installed. When the `nonstreaming_google_genai_model_response` fixture at line 1331 accesses `google.genai.types.*`, it will raise `AttributeError: module 'google' has no attribute 'genai'` if the package isn't installed but other google packages are.


@pytest.fixture
def responses_tool_call_model_responses():
def inner(
Expand Down
Loading
Loading