Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Implement provider interface and OpenAI and Anthropic providers #66

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Nov 22, 2024

Implements an interface for building CodeGate providers. For now we use
LiteLLM, but we might switch in the future, so the LiteLLM calls are
abstracted away in the litellmshim module in two classes:

  • BaseAdapter which provides means for reusing LiteLLM adapters with
    the same interface.
  • LiteLLmShim that actually calls into liteLLM's completion and
    calls the adapter before completion to convert into liteLLM's format
    and then back after completion

Using those interfaces, implements an OpenAI and an Anthropic provider.

With this patch, codegate allows to pass through requests towards OpenAI
and Anthropic. Next, we'll build a pipeline interface to modify the
inputs and outputs.

Implements an interface for building CodeGate providers. For now we use
LiteLLM, but we might switch in the future, so the LiteLLM calls are
abstracted away in the `litellmshim` module in two classes:
- `BaseAdapter` which provides means for reusing LiteLLM adapters with
  the same interface.
- `LiteLLmShim` that actually calls into liteLLM's completion and
  calls the adapter before completion to convert into liteLLM's format
  and then back after completion

Using those interfaces, implements an OpenAI and an Anthropic provider.

With this patch, codegate allows to pass through requests towards OpenAI
and Anthropic. Next, we'll build a pipeline interface to modify the
inputs and outputs.
Copy link

@lukehinds lukehinds left a comment

Choose a reason for hiding this comment

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

this looks good to me, pepper in some tests and we can ship.

@lukehinds lukehinds added this to the 0.1.0 (flagship) milestone Nov 22, 2024
@jhrozek jhrozek merged commit 4d47146 into stacklok:main Nov 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants