Skip to content

Comments

feat: add OpenAI-first provider selection with OpenRouter fallback#11

Open
mjalalimanesh wants to merge 2 commits intoagno-agi:mainfrom
mjalalimanesh:feat/openrouter-fallback-pr
Open

feat: add OpenAI-first provider selection with OpenRouter fallback#11
mjalalimanesh wants to merge 2 commits intoagno-agi:mainfrom
mjalalimanesh:feat/openrouter-fallback-pr

Conversation

@mjalalimanesh
Copy link

Summary

This PR adds provider selection that preserves original OpenAI behavior and uses OpenRouter only as fallback.

Behavior

  • If OPENAI_API_KEY is set: Dash uses OpenAI model + OpenAI embedding path (original behavior).
  • Else if OPENROUTER_API_KEY is set: Dash uses OpenRouter model + OpenRouter-backed embedding path.
  • If both are set: OpenAI takes priority.
  • If neither is set: current failure behavior is unchanged.

Changes

  • dash/agents.py
    • Added provider selection logic (OpenAI first, OpenRouter fallback).
    • Added OpenRouter model/embedding configuration for fallback path only.
  • example.env
    • Documented key priority and fallback behavior.
  • README.md
    • Updated env docs and quick-start note for key priority.

Scope control

Included only runtime/docs for provider fallback.

Not included:

  • .gitlab-ci.yml
  • compose.yaml
  • deployment/infrastructure changes
  • analytics-db related changes

Validation

  • python -m compileall dash db app
  • Manual sanity checks for key matrix:
    • OpenAI only -> OpenAI path
    • OpenRouter only -> OpenRouter path
    • both -> OpenAI path

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.

1 participant