Skip to content

fix: reject LLM calls with incompatible contexts - #34

Open
mikemikimike wants to merge 1 commit into
sqliteai:mainfrom
mikemikimike:fix/context-kind-mismatch
Open

fix: reject LLM calls with incompatible contexts#34
mikemikimike wants to merge 1 commit into
sqliteai:mainfrom
mikemikimike:fix/context-kind-mismatch

Conversation

@mikemikimike

Copy link
Copy Markdown

Summary / Problem

Closes #33. llm_text_generate() and llm_embed_generate() only checked whether a context existed, so calling one with the other operation's context could silently return an empty result or run against incompatible state.

Changes

  • Track whether each llama context is for text generation, embeddings, or chat.
  • Reject text/embedding generation calls when the active context kind does not match, returning SQLITE_MISUSE with an actionable error.
  • Add a regression test covering both mismatch directions.

Tests

  • git diff --check — passed.
  • Docker-based C test compilation was attempted with Alpine Linux, but the container's package installation stalled without output in the available environment; the C test binary and full test suite were not run.

Compatibility / Known limitations

Valid calls retain their existing behavior. This changes an invalid context/operation combination from a silent result to an explicit SQLITE_MISUSE error. The full model-backed test suite remains to be run in an environment with the repository's native toolchain and test model dependencies.

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.

llm_text_generate() returns '' with no error when the active model/context is an embedding one

1 participant