Skip to content

feat: add llamafile provider#1519

Open
Sarah-2003 wants to merge 2 commits into0xPlaygrounds:mainfrom
Sarah-2003:feat/llamafile-support
Open

feat: add llamafile provider#1519
Sarah-2003 wants to merge 2 commits into0xPlaygrounds:mainfrom
Sarah-2003:feat/llamafile-support

Conversation

@Sarah-2003
Copy link

Add a new provider for llamafile, a Mozilla Builders project that distributes LLMs as single-file executables. Llamafile exposes an OpenAI-compatible API locally and this provider reuses the existing OpenAI message/response types for maximum compatibility.

  • No API key required (uses Nothing type)
  • Configurable base URL via LLAMAFILE_API_BASE_URL env var
  • Supports chat completions and streaming
  • Includes 3 unit tests and an example

Fixes #489

Add a new provider for llamafile, a Mozilla Builders project that
distributes LLMs as single-file executables. Llamafile exposes an
OpenAI-compatible API locally and this provider reuses the existing
OpenAI message/response types for maximum compatibility.

- No API key required (uses Nothing type)
- Configurable base URL via LLAMAFILE_API_BASE_URL env var
- Supports chat completions and streaming
- Includes 3 unit tests and an example

Fixes 0xPlaygrounds#489
Copy link
Collaborator

@joshua-mo-143 joshua-mo-143 left a comment

Choose a reason for hiding this comment

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

please see comments

- Move system_instructions into info_span! invocation instead of
  using span.record() for both completion() and stream() methods
- Add EmbeddingModel support using OpenAI-compatible /v1/embeddings
  endpoint, changing Capabilities from Nothing to Capable<EmbeddingModel>
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.

feat: Add support for llamafile

3 participants