Skip to content

feat(graphile-llm): add onQuotaExceeded option to control embedding failure behavior#1291

Open
pyramation wants to merge 1 commit into
mainfrom
feat/llm-quota-exceeded-option
Open

feat(graphile-llm): add onQuotaExceeded option to control embedding failure behavior#1291
pyramation wants to merge 1 commit into
mainfrom
feat/llm-quota-exceeded-option

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

Adds onQuotaExceeded: 'degrade' | 'throw' option to createLlmTextSearchPlugin() and GraphileLlmPreset().

When the embedder returns null (billing quota exceeded, provider unavailable), the current behavior silently falls back to text-only search. This is fine for most cases, but some apps need semantic search to be critical — keyword-only results are unacceptable.

// Default: graceful degradation (skip vector, text adapters still work)
GraphileLlmPreset({ onQuotaExceeded: 'degrade' })

// Strict: throw error even if text adapters could handle it
GraphileLlmPreset({ onQuotaExceeded: 'throw' })

When no text adapters exist on the table, throws regardless of this setting (no fallback possible).

The option flows through: GraphileLlmOptions.onQuotaExceededcreateLlmTextSearchPlugin({ onQuotaExceeded })embedTextInWhere(where, embedder, hasTextAdapters, onQuotaExceeded).

6 new unit tests covering both modes + edge cases (no text adapters, successful embed in throw mode).

Link to Devin session: https://app.devin.ai/sessions/4a9f098c74fb4cb6a9b6868fcff321db
Requested by: @pyramation

…ailure behavior

Add 'degrade' | 'throw' option at the plugin level:
- 'degrade' (default): skip vector search silently, fall back to text adapters
- 'throw': always error when embedder fails, even if text adapters exist

Configurable via createLlmTextSearchPlugin({ onQuotaExceeded: 'throw' })
or GraphileLlmPreset({ onQuotaExceeded: 'throw' }).

When no text adapters are available, throws regardless of this setting.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 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

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