cline icon indicating copy to clipboard operation
cline copied to clipboard

feat: add inference.net provider

Open zaidmukaddam opened this issue 9 months ago • 1 comments

  • Introduced InferenceHandler for handling inference requests.
  • Updated ApiHandler interface to include inference option.
  • Added inference models and configuration to shared API definitions.
  • Implemented message creation and streaming for inference responses.

Description

This PR adds a new AI provider - Inference.net - which gives users access to Meta's Llama 3.1 models (both 8B and 70B versions) through the inference.net API. The implementation follows the same pattern as other OpenAI-compatible providers like x.ai, using the OpenAI SDK with a custom base URL.

Users can now configure their Inference.net API key in the settings and select from the available models. The implementation handles streaming responses properly and formats them according to the application's expectations.

Test Procedure

  • Verified that the inference provider can be selected in the UI
  • Tested chatting with both Llama 3.1 8B and 70B and Llama 3.3 70B models
  • Confirmed that streaming responses work correctly
  • Checked that environment variables for API keys are properly recognized

Type of Change

  • [x] ✨ New feature (non-breaking change which adds functionality)

Pre-flight Checklist

  • [x] Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
  • [x] Tests are passing (npm test) and code is formatted and linted (npm run format && npm run lint)
  • [x] I have created a changeset using npm run changeset (required for user-facing changes)
  • [x] I have reviewed contributor guidelines

[!IMPORTANT] Add Inference.net provider to handle Meta's Llama models with streaming support and configuration options.

  • New Provider:
    • Added InferenceHandler in inference.ts for handling Inference.net requests.
    • Updated ApiHandler interface in index.ts to include Inference.net.
    • Added inference to ApiProvider in api.ts.
  • Models and Configuration:
    • Defined InferenceModelId and inferenceModels in inference.ts.
    • Added inferenceApiKey to ApiHandlerOptions in api.ts.
  • Functionality:
    • Implemented createMessage() in InferenceHandler to handle message streaming.
    • Configured model selection and API key usage in inference.ts.

This description was created by Ellipsis for efd77c55bf19689a81d748d3eb4f2cd61a3a48ea. It will automatically update as commits are pushed.

zaidmukaddam avatar Mar 18 '25 19:03 zaidmukaddam

🦋 Changeset detected

Latest commit: c5d5e5d3954968ee818b82cdaa1661b890298d42

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
claude-dev Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Mar 18 '25 19:03 changeset-bot[bot]

@zaidmukaddam we're changing up our process a bit for adding providers. can you create a feature request for this if you'd like to add this provider. essentially we want to have a conversation about whether users will want this before any prs

0xToshii avatar Jun 20 '25 19:06 0xToshii