Skip to content

test(e2e): add live Fireworks AI chat completions coverage - #33975

Closed
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
litellm_fireworks_e2e_test
Closed

devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
litellm_fireworks_e2e_test

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Relevant issues

Follow-up to the Fireworks 415 regression from b3d05bd (#33717). The fix itself ships in a separate PR; this PR adds the e2e coverage that would have caught it

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

The Fireworks provider had no live e2e coverage, only mocked SDK/translation unit tests that patch the HTTP handler and never send a real request, so nothing exercised the header + serialization path that b3d05bd broke. These three tests drive a real fireworks_ai/accounts/fireworks/models/kimi-k2p6 chat completion through a live proxy and cost real money

Before, against the current buggy staging (commit bd44c9e305), all three fail with the exact upstream 415:

tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_basic_chat_completion_returns_content FAILED
tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_basic_chat_completion_logs_cost FAILED
tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_streaming_chat_completion_returns_content FAILED

AssertionError: ... Fireworks_aiException - {"error":{"message":"Incorrect content type, was
application/octet-stream but should be application/json","code":"UNSUPPORTED_MEDIA_TYPE"...}}, "code":"415"

After, with the one-line fix applied on top of bd44c9e305 (restore Content-Type: application/json in FireworksAIMixin.validate_environment), all three pass against the same live proxy:

tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_basic_chat_completion_returns_content PASSED
tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_basic_chat_completion_logs_cost PASSED
tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_streaming_chat_completion_returns_content PASSED

3 passed in 10.15s

The proxy ran locally against a real Postgres with store_model_in_db, each test registered its deployment via /model/new and deleted it on teardown, and the cost test polled /spend/logs for a costed row keyed on the completion id

Type

✅ Test

Changes

tests/e2e/llm_translation/test_fireworks_ai_e2e.py covers OpenAI-format /chat/completions translated to the Fireworks provider: a non-streaming call returns content, its cost lands on a spend row tagged custom_llm_provider="fireworks_ai", and a streaming call returns SSE events with no in-stream error. Any of these is enough to catch a dropped Content-Type header, since Fireworks 415s the request before a completion comes back

The coverage registry gains three llm.chat_completions.fireworks_ai.basic.* cells (the non-streaming works cell is marked fail_before_fix: proven), and fireworks_ai joins the LlmRoute vocab in coverage_registry/schema.py and the route grammar in tests/e2e/CLAUDE.md

QA runbook

Prerequisites: a live proxy on :4000 with store_model_in_db: true and a Postgres, FIREWORKS_AI_API_KEY in the proxy env, master key sk-1234. Model accounts/fireworks/models/kimi-k2p6 must be deployed on the Fireworks account (adjust BACKEND_MODEL if the account serves a different model)

  • tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_basic_chat_completion_returns_content - a Fireworks-backed deployment serves a real non-streaming chat completion with non-empty content

    • Register it: curl -X POST http://localhost:4000/model/new -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model_name":"e2e-fireworks","litellm_params":{"model":"fireworks_ai/accounts/fireworks/models/kimi-k2p6","api_key":"os.environ/FIREWORKS_AI_API_KEY"}}'
    • curl -X POST http://localhost:4000/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model":"e2e-fireworks","messages":[{"role":"user","content":"reply with exactly one word"}],"max_tokens":32}'
    • Expect a 200 whose choices[0].message.content is non-empty; on the buggy build expect a 415 UNSUPPORTED_MEDIA_TYPE from Fireworks instead
    • Sanity check: this test makes sense to add and is not hand-wavey or potentially flaky
  • tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_basic_chat_completion_logs_cost - the same call writes a costed spend row attributed to the Fireworks provider

    • Send the chat request above and note the returned id
    • Poll curl "http://localhost:4000/spend/logs?request_id=" -H "Authorization: Bearer sk-1234" until a row lands (spend flushes on proxy_batch_write_at)
    • Expect one row with spend > 0, custom_llm_provider "fireworks_ai", and a model containing "kimi-k2p6"
    • Sanity check: this test makes sense to add and is not hand-wavey or potentially flaky
  • tests/e2e/llm_translation/test_fireworks_ai_e2e.py::TestFireworksAIChatCompletions::test_streaming_chat_completion_returns_content - a streaming Fireworks chat completion returns SSE events with no in-stream error

    • curl -N -X POST http://localhost:4000/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model":"e2e-fireworks","messages":[{"role":"user","content":"count to three"}],"max_tokens":64,"stream":true}'
    • Expect a 200 text/event-stream carrying data: chunks and a final [DONE]; on the buggy build expect a 415 before any chunk
    • Sanity check: this test makes sense to add and is not hand-wavey or potentially flaky

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/678fef34cdf049ed9e8fbadc3c65ac35
Requested by: @krrish-berri-2

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@krrish-berri-2 krrish-berri-2 self-assigned this Jul 20, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds live end-to-end coverage for the Fireworks AI chat completions path, filling the gap that let the b3d05bd Content-Type regression ship undetected. All four changed files are confined to tests/e2e/.

  • New test file (test_fireworks_ai_e2e.py): three independent tests — non-streaming content, spend-row cost attribution, and streaming SSE — each registering and tearing down a fireworks_ai deployment at runtime. The tests follow harness conventions (typed bodies, resources.defer, unique_marker(), no raw requests calls).
  • Registry and schema: three new P0 cells added to llm_conversational.yaml (the non-streaming works cell carries fail_before_fix: proven), fireworks_ai added to LlmRoute in schema.py, and CLAUDE.md route grammar updated to match.

Confidence Score: 5/5

Safe to merge — all changes are confined to the e2e test directory and coverage registry; no production code is touched.

The three new tests faithfully follow the established harness conventions: per-test provisioning via _provision, teardown through resources.defer, unique markers to avoid cache collisions, typed Pydantic bodies, and unwrap for hard failure on any non-success response. Registry cell IDs align exactly with the @pytest.mark.covers declarations, the LlmRoute Literal extension is minimal and correct, and the CLAUDE.md grammar comment stays in sync. No monkeypatching, no raw requests imports, and no xfail markers.

No files require special attention.

Important Files Changed

Filename Overview
tests/e2e/llm_translation/test_fireworks_ai_e2e.py New live e2e test file covering Fireworks AI chat completions (non-streaming content, cost logging, and streaming). Follows harness conventions correctly: per-test resource provisioning, unique markers, typed bodies, and teardown via resources.defer.
tests/e2e/coverage_registry/llm_conversational.yaml Adds three P0 registry cells for Fireworks AI (nonstream.works with fail_before_fix:proven, stream.works, nonstream.cost_logged); cell IDs match the @pytest.mark.covers declarations in the test file.
tests/e2e/coverage_registry/schema.py Adds fireworks_ai to the LlmRoute Literal; minimal, correct schema extension.
tests/e2e/CLAUDE.md Adds fireworks_ai to the route grammar comment; keeps docs in sync with the schema change.

Reviews (1): Last reviewed commit: "test(e2e): add live Fireworks AI chat co..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_fireworks_e2e_test (280090c) with litellm_internal_staging (214945a)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (fa59cfa) during the generation of this report, so 214945a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@yuneng-berri
yuneng-berri deleted the branch main September 13, 2026 04:33
@yuneng-berri yuneng-berri reopened this Sep 13, 2026
@devin-ai-integration
devin-ai-integration Bot changed the base branch from litellm_internal_staging to main September 23, 2026 15:36
@devin-ai-integration
devin-ai-integration Bot requested a review from a team September 23, 2026 15:36
@tin-berri

Copy link
Copy Markdown
Contributor

Closing as stale: no activity in the last 30 days. Feel free to reopen if this is still relevant.

@tin-berri tin-berri closed this Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants