Skip to content

Development environment setup - #22160

Merged
ishaan-jaff merged 4 commits into
mainfrom
cursor/development-environment-setup-ad2f
Feb 26, 2026
Merged

Development environment setup#22160
ishaan-jaff merged 4 commits into
mainfrom
cursor/development-environment-setup-ad2f

Conversation

@ishaan-jaff

@ishaan-jaff ishaan-jaff commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

[Feat] Realtime API show logs / session runs

image

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
✅ Test

Changes

This PR introduces a "Pretty View" for realtime API logs within the LiteLLM dashboard, improving readability over the raw JSON display.

  • New RealtimePrettyView component: Renders structured information for realtime logs, including session configuration (model, voice, modalities, temperature, instructions) and conversation turns (status, transcripts, detailed token breakdowns for text, audio, image, and cached tokens).
  • Realtime response detection: Added an isRealtimeResponse() helper function to identify realtime API responses based on specific event types (session.created, response.done) in the results array.
  • Integration with PrettyMessagesView: The existing PrettyMessagesView now automatically detects realtime responses and delegates rendering to the new RealtimePrettyView component.
  • Comprehensive testing: Added 27 new unit tests (24 for RealtimePrettyView and 3 for PrettyMessagesView) to ensure correct rendering, interaction, collapse behavior, token display, and edge case handling.
  • Visual validation: Confirmed functionality with a live E2E demo on the LiteLLM Logs page, demonstrating the toggle between the new Pretty view and the raw JSON view.

Open in Web Open in Cursor 

cursoragent and others added 3 commits February 26, 2026 06:00
- Create RealtimePrettyView component that renders structured session
  config, conversation turns with transcripts, and token breakdowns
- Update PrettyMessagesView to detect realtime responses (via
  isRealtimeResponse helper) and delegate to the new component
- Session card shows model, voice, modalities, temperature, instructions
  in a collapsible panel
- Conversation turns show status, per-turn token usage, and audio/text
  transcripts with appropriate icons
- Add 24 tests for RealtimePrettyView and 3 tests for PrettyMessagesView
- All 75 LogDetailsDrawer tests pass

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
…ut header

- Add purple 'N turns' tag to Session card header for at-a-glance turn count
- Add 'Turns: N' to the Output section header next to tokens/cost
- Extend SectionHeader to accept optional turnCount prop
- Add 3 new tests for turn count display (singular, plural, output header)

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
@cursor

cursor Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel

vercel Bot commented Feb 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 26, 2026 7:14am

Request Review

@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 Feb 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a "Pretty View" for OpenAI Realtime API logs in the LiteLLM dashboard, rendering structured session configuration, conversation turns, and token usage instead of raw JSON.

  • New RealtimePrettyView component with session card (model, voice, modalities, instructions) and conversation card (turns with status, transcripts, token breakdowns)
  • isRealtimeResponse() detection function routes realtime API responses to the specialized view from PrettyMessagesView
  • SectionHeader extended with optional turnCount prop for realtime output sections
  • Comprehensive tests (27 tests across two test files) covering rendering, interactions, collapse behavior, and edge cases
  • Logic issue: isRealtimeResponse() detects event types (response.audio.done, conversation.item.created) that RealtimePrettyView doesn't actually render, which could cause valid realtime responses to show a misleading fallback message

Confidence Score: 3/5

  • This PR is a UI-only addition with good test coverage but has a detection/rendering mismatch that could cause display issues for some realtime response types.
  • Score of 3 reflects that while the PR is well-structured with comprehensive tests and clean component architecture, the mismatch between isRealtimeResponse() detection and actual rendering could cause edge-case display regressions where valid realtime events show a fallback message instead of the standard view.
  • RealtimePrettyView.tsx needs attention — specifically the isRealtimeResponse() function should be aligned with the event types the component actually renders.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/RealtimePrettyView.tsx New component for rendering realtime API logs. Has a mismatch between event types detected by isRealtimeResponse() and those actually rendered, which can cause fallback display for valid realtime responses.
ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/PrettyMessagesView.tsx Clean integration — detects realtime responses early and delegates to the new specialized view. The routing correctness depends on isRealtimeResponse being accurate.
ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/SectionHeader.tsx Minimal change adding an optional turnCount prop displayed in the header. Clean and backwards-compatible.
ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/RealtimePrettyView.test.tsx Comprehensive test suite covering rendering, interactions, edge cases, and token display. Follows AGENTS.md testing conventions well.
ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/PrettyMessagesView.test.tsx Good integration tests verifying routing between standard and realtime views. Tests follow project conventions.
ui/litellm-dashboard/package-lock.json Lock file changes removing dev: true flags from some dependencies. Auto-generated, no functional risk.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PrettyMessagesView] -->|response| B{isRealtimeResponse?}
    B -->|true| C[RealtimePrettyView]
    B -->|false| D[Standard InputCard + OutputCard]
    C --> E{Parse events}
    E -->|session.created / session.updated| F[SessionCard]
    E -->|response.done| G[ConversationCard]
    E -->|No matching events| H["Fallback: No recognized events"]
    G --> I[ResponseTurn per response]
    I --> J[OutputMessage with transcripts]
    I --> K[TokenBreakdown details]
    F --> L[ConfigRow grid + Instructions]
Loading

Last reviewed commit: 1f0cb47

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +82 to +95
export function isRealtimeResponse(response: any): boolean {
if (!response || !response.results || !Array.isArray(response.results) || response.results.length === 0) {
return false;
}

return response.results.some(
(r: any) =>
r.type === 'session.created' ||
r.type === 'session.updated' ||
r.type === 'response.done' ||
r.type === 'response.audio.done' ||
r.type === 'conversation.item.created'
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detection/rendering event type mismatch

isRealtimeResponse() recognizes five event types (session.created, session.updated, response.done, response.audio.done, conversation.item.created), but RealtimePrettyView only renders session.created/session.updated and response.done. If a realtime response contains only response.audio.done or conversation.item.created events, isRealtimeResponse returns true and PrettyMessagesView routes to this component, but it will display "No recognized realtime events found" instead of the standard chat view.

Either the detection function should only match event types that the view actually handles, or the view should handle all the detected types.

Suggested change
export function isRealtimeResponse(response: any): boolean {
if (!response || !response.results || !Array.isArray(response.results) || response.results.length === 0) {
return false;
}
return response.results.some(
(r: any) =>
r.type === 'session.created' ||
r.type === 'session.updated' ||
r.type === 'response.done' ||
r.type === 'response.audio.done' ||
r.type === 'conversation.item.created'
);
}
export function isRealtimeResponse(response: any): boolean {
if (!response || !response.results || !Array.isArray(response.results) || response.results.length === 0) {
return false;
}
return response.results.some(
(r: any) =>
r.type === 'session.created' ||
r.type === 'session.updated' ||
r.type === 'response.done'
);
}

return (
<div
style={{
marginBottom: index >= 0 ? 12 : 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always-true condition in ternary

index >= 0 is always true since array .map() indices start at 0, making the : 0 branch unreachable dead code. If the intent was to skip margin on the last item, this should compare against the total count. As-is, it's equivalent to just marginBottom: 12.

Suggested change
marginBottom: index >= 0 ? 12 : 0,
marginBottom: 12,

- Remove response.audio.done and conversation.item.created from
  isRealtimeResponse() detection since the view doesn't render them;
  prevents misleading fallback for responses with only those events
- Remove dead code: index >= 0 is always true in .map() callback

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
@ishaan-jaff
ishaan-jaff merged commit 3545584 into main Feb 26, 2026
29 of 34 checks passed
Sameerlite pushed a commit that referenced this pull request Mar 3, 2026
* feat: add pretty view for realtime API logs in dashboard

- Create RealtimePrettyView component that renders structured session
  config, conversation turns with transcripts, and token breakdowns
- Update PrettyMessagesView to detect realtime responses (via
  isRealtimeResponse helper) and delegate to the new component
- Session card shows model, voice, modalities, temperature, instructions
  in a collapsible panel
- Conversation turns show status, per-turn token usage, and audio/text
  transcripts with appropriate icons
- Add 24 tests for RealtimePrettyView and 3 tests for PrettyMessagesView
- All 75 LogDetailsDrawer tests pass

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* chore: remove dev_config.yaml from tracked files

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* feat: show turn count in realtime pretty view session header and output header

- Add purple 'N turns' tag to Session card header for at-a-glance turn count
- Add 'Turns: N' to the Output section header next to tokens/cost
- Extend SectionHeader to accept optional turnCount prop
- Add 3 new tests for turn count display (singular, plural, output header)

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* fix: address Greptile review feedback

- Remove response.audio.done and conversation.item.created from
  isRealtimeResponse() detection since the view doesn't render them;
  prevents misleading fallback for responses with only those events
- Remove dead code: index >= 0 is always true in .map() callback

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
* feat: add pretty view for realtime API logs in dashboard

- Create RealtimePrettyView component that renders structured session
  config, conversation turns with transcripts, and token breakdowns
- Update PrettyMessagesView to detect realtime responses (via
  isRealtimeResponse helper) and delegate to the new component
- Session card shows model, voice, modalities, temperature, instructions
  in a collapsible panel
- Conversation turns show status, per-turn token usage, and audio/text
  transcripts with appropriate icons
- Add 24 tests for RealtimePrettyView and 3 tests for PrettyMessagesView
- All 75 LogDetailsDrawer tests pass

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* chore: remove dev_config.yaml from tracked files

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* feat: show turn count in realtime pretty view session header and output header

- Add purple 'N turns' tag to Session card header for at-a-glance turn count
- Add 'Turns: N' to the Output section header next to tokens/cost
- Extend SectionHeader to accept optional turnCount prop
- Add 3 new tests for turn count display (singular, plural, output header)

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* fix: address Greptile review feedback

- Remove response.audio.done and conversation.item.created from
  isRealtimeResponse() detection since the view doesn't render them;
  prevents misleading fallback for responses with only those events
- Remove dead code: index >= 0 is always true in .map() callback

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
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.

3 participants