Skip to content

Add new models and providers (OpenAI, SambaNova)#174

Merged
barun-saha merged 4 commits intomainfrom
maintenance
Nov 22, 2025
Merged

Add new models and providers (OpenAI, SambaNova)#174
barun-saha merged 4 commits intomainfrom
maintenance

Conversation

@barun-saha
Copy link
Owner

@barun-saha barun-saha commented Nov 22, 2025

Closes #167.

Summary by CodeRabbit

  • New Features

    • Added OpenAI provider and new models ([oa]gpt-4.1-mini, [oa]gpt-4.1-nano, [oa]gpt-5-nano)
    • Added SambaNova DeepSeek-V3.1-Terminus model support
    • Extended API key validation to accept longer keys (up to 200 chars)
  • Documentation

    • Updated README with PyPI, License, and Streamlit badges
    • Reformatted git LFS note and LLM section note; adjusted LLM table header formatting
  • Refactor

    • Simplified application startup (removed main() wrapper)

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Walkthrough

The PR updates README formatting and badges, adds OpenAI and SambaNova provider/model entries and env key mapping, widens API key validation to 6–200 chars and enables litellm.drop_params, and simplifies the app entry point to call build_ui() directly (removed main()).

Changes

Cohort / File(s) Summary
Documentation
README.md
Added PyPI, License, and Streamlit badges; converted git LFS note to a blockquote; adjusted LLM table header formatting.
Application entry
app.py
Removed the main() wrapper; if __name__ == '__main__' now calls build_ui() directly; updated input validation length for API key from 94→200 in are_all_inputs_valid.
Provider & models config
src/slidedeckai/global_config.py
Added PROVIDER_OPENAI = 'oa'; extended LITELLM_PROVIDER_MAPPING, VALID_PROVIDERS, and PROVIDER_ENV_KEYS to include OpenAI; added OpenAI model entries ([oa]gpt-4.1-mini, [oa]gpt-4.1-nano, [oa]gpt-5-nano) and SambaNova [sn]DeepSeek-V3.1-Terminus; updated LLM_PROVIDER_HELP text.
LLM helper
src/slidedeckai/helpers/llm_helper.py
Set litellm.drop_params = True during init; expanded API_KEY_REGEX from 6–128 to 6–200 chars (re.compile(r'^[a-zA-Z0-9_-]{6,200}$')).

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant App as app.py
  participant UI as build_ui()
  Note over App,UI `#DDEBF7`: App process start (module run)
  User->>App: run script
  App->>UI: call build_ui()
  UI-->>User: render UI
Loading
sequenceDiagram
  participant Init as LiteLLM init
  participant LLMHelper as llm_helper
  Note over LLMHelper,Init `#F7F0DD`: LLM initialization path
  LLMHelper->>Init: import/setup litellm
  LLMHelper-->>Init: set drop_params = true
  LLMHelper->>LLMHelper: validate API key (regex 6–200)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Heterogeneous changes: docs, app entry, config, and helper logic.
  • Areas to focus:
    • Verify new provider identifiers and model strings conform to existing parsing/usage.
    • Check PROVIDER_ENV_KEYS mapping and any runtime code that reads env keys.
    • Confirm litellm.drop_params = True compatibility with current LiteLLM usage.
    • Ensure widened regex aligns with UI validation and backend expectations.

Possibly related PRs

Poem

🐰 I hopped in code to tweak and mend,
New models added, and keys extend.
A tiny call now starts the show,
Badges gleam and mappings grow.
Happy hops — the slide decks glow! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding OpenAI and SambaNova providers with their associated models.
Linked Issues check ✅ Passed The pull request adds OpenAI and SambaNova providers with new models as required, implementing the primary objective of issue #167.
Out of Scope Changes check ✅ Passed Changes include API key validation updates and entry point refactoring, which appear to be related improvements for model/provider integration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch maintenance

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 038342d and a0d261f.

📒 Files selected for processing (2)
  • app.py (2 hunks)
  • src/slidedeckai/helpers/llm_helper.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/slidedeckai/helpers/llm_helper.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (3.10)
🔇 Additional comments (2)
app.py (2)

545-545: LGTM! Simplified entry point.

Calling build_ui() directly removes an unnecessary wrapper layer and simplifies the code without changing functionality.


146-146: No issues found—API key validation is consistent across the codebase.

The error message stating "6-200 characters" aligns with the API_KEY_REGEX pattern in llm_helper.py (line 33), which is {6,200}. All references are consistent and no conflicting length specifications exist elsewhere.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app.py (1)

146-147: Update the error message to match the updated API key length validation.

The error message states "6-94 characters," but the API_KEY_REGEX in src/slidedeckai/helpers/llm_helper.py (Line 33) now accepts 6-200 characters. This inconsistency will confuse users whose valid API keys (95-200 characters) are accepted by the validation logic but described as invalid in the error message.

Apply this diff to fix the error message:

         handle_error(
             'The LLM settings do not look correct. Make sure that an API key/access token'
-            ' is provided if the selected LLM requires it. An API key should be 6-94 characters'
+            ' is provided if the selected LLM requires it. An API key should be 6-200 characters'
             ' long, only containing alphanumeric characters, hyphens, and underscores.\n\n'
             'If you are using Azure OpenAI, make sure that you have provided the additional and'
             ' correct configurations.',
             False
         )
♻️ Duplicate comments (1)
README.md (1)

98-100: Model names should be verified (related to global_config.py verification).

The OpenAI model names listed here (GPT-4.1-mini, GPT-4.1-nano, GPT-5) match those added in src/slidedeckai/global_config.py but require verification. See the verification request in the review comment for src/slidedeckai/global_config.py Lines 103-117.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51a1ad7 and 038342d.

📒 Files selected for processing (4)
  • README.md (3 hunks)
  • app.py (1 hunks)
  • src/slidedeckai/global_config.py (9 hunks)
  • src/slidedeckai/helpers/llm_helper.py (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: barun-saha
Repo: barun-saha/slide-deck-ai PR: 139
File: helpers/llm_helper.py:70-84
Timestamp: 2025-09-23T04:32:09.863Z
Learning: Hugging Face model support has been discontinued in the slide-deck-ai project, so PROVIDER_HUGGING_FACE should remain commented out in GlobalConfig.VALID_PROVIDERS and validation should continue rejecting 'hf' providers.
📚 Learning: 2025-09-23T04:32:09.863Z
Learnt from: barun-saha
Repo: barun-saha/slide-deck-ai PR: 139
File: helpers/llm_helper.py:70-84
Timestamp: 2025-09-23T04:32:09.863Z
Learning: Hugging Face model support has been discontinued in the slide-deck-ai project, so PROVIDER_HUGGING_FACE should remain commented out in GlobalConfig.VALID_PROVIDERS and validation should continue rejecting 'hf' providers.

Applied to files:

  • src/slidedeckai/global_config.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (3.10)
🔇 Additional comments (7)
app.py (1)

545-545: LGTM! Clean refactor of the entry point.

Directly calling build_ui() under the __main__ guard simplifies the code structure by removing an unnecessary wrapper function.

src/slidedeckai/helpers/llm_helper.py (1)

16-17: LGTM! Enables better provider compatibility.

Setting litellm.drop_params = True allows LiteLLM to ignore unsupported parameters when making requests to different providers, improving cross-provider compatibility.

src/slidedeckai/global_config.py (3)

28-28: LGTM! OpenAI provider integration follows the established pattern.

The OpenAI provider constant, mapping, validation set, and environment key configuration are correctly structured and consistent with other providers in the codebase.

Also applies to: 42-42, 51-51, 61-61


156-163: LGTM! Documentation updated to include new providers.

The provider help text correctly documents the new OpenAI ([oa]) and SambaNova ([sn]) provider codes.


103-117: The flagged model names are valid; this review comment is incorrect.

The OpenAI API documentation confirms that gpt-4.1-mini and gpt-4.1-nano are valid GPT-4.1 family models, and gpt-5-nano is a valid GPT-5 family model. The code entries at lines 103-117 accurately reflect OpenAI's current supported models as of November 2025. The [oa] prefix is a local naming convention in this codebase and does not affect API compatibility.

Likely an incorrect or invalid review comment.

README.md (2)

14-17: LGTM! Added useful project badges.

The PyPI, License, and Streamlit badges improve the README by providing quick access to important project information and metrics.


161-161: LGTM! Improved formatting for important information.

Using blockquote style with an emoji effectively highlights this critical step about running git lfs pull.

Comment on lines +128 to +132
'[sn]DeepSeek-V3.1-Terminus': {
'description': 'fast, detailed',
'max_new_tokens': 8192,
'paid': True,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the SambaNova model name with the official API documentation.

The model name DeepSeek-V3.1-Terminus should be verified against SambaNova's API documentation to ensure it's correctly specified and currently supported.

Please search the web to verify the SambaNova model names:


🌐 Web query:

What models are available through SambaNova Cloud API as of November 2025?

💡 Result:

Short answer — SambaNova Cloud exposes a broad catalog of open and proprietary LLMs as of November 22, 2025, including (representative list):

  • DeepSeek family: DeepSeek-R1 (671B) and DeepSeek V3 series. [1][2]
  • Meta Llama families: Llama 3.x (multiple sizes including 405B, 90B, 70B, 11B, 8B, 1–3B variants) and Llama 4 Maverick (17B). [3][4][5]
  • Qwen family: Qwen 2.5 Coder (32B, 72B) and Qwen3 (e.g., 32B). [6][5]
  • Samba-1 family / routers and CoE variants (Samba-1-Instruct-Router, Samba-1-Chat-Router, Samba-1 Turbo options). [4]
  • Other multimodal and embedding models listed in SambaNova docs (CLIP, DePlot, E5 Large V2 and related multimodal checkpoints). [4]

Sources / further reading:

  1. SambaNova Cloud dashboard / model listing. [cloud.sambanova.ai]. [1]
  2. SambaNova press material announcing DeepSeek‑R1 availability. [2]
  3. sambanova-gradio / registry (explicit model IDs for Llama 3.2 / 3.1 families). [3]
  4. SambaNova documentation / release notes (SambaStudio model cards, routers, multimodal models). [4]
  5. Third‑party integrations / docs referencing available models (ElevenLabs integration listing popular SambaNova models). [5]
  6. SambaNova blog post: Qwen 2.5 Coder on SambaNova Cloud. [6]

If you’d like, I can fetch the live model catalog (names + exact model IDs and context windows) from your SambaNova Cloud API endpoint and format it for you — do you want me to do that?


Correct the SambaNova model name—DeepSeek-V3.1-Terminus is not available in SambaNova Cloud API.

SambaNova Cloud exposes DeepSeek-R1 and DeepSeek V3 series, but DeepSeek-V3.1-Terminus does not appear in the documented model catalog. Update the model identifier to match an available DeepSeek variant (e.g., DeepSeek-V3 or DeepSeek-R1) to prevent runtime failures when this configuration is used.

🤖 Prompt for AI Agents
In src/slidedeckai/global_config.py around lines 128 to 132, the SambaNova model
identifier 'DeepSeek-V3.1-Terminus' is invalid and will cause runtime failures;
replace it with a valid SambaNova model name such as 'DeepSeek-V3' (or
'DeepSeek-R1' if intended) and update the dictionary key and any related
metadata (description, max_new_tokens, paid flag) as needed to reflect the
chosen variant so the configuration matches the documented SambaNova Cloud model
catalog.

@barun-saha barun-saha merged commit 5ba68ba into main Nov 22, 2025
5 checks passed
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.

Add new models

1 participant