Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LiteLLM - support for Vertex AI, Gemini, Anthropic, Bedrock (100+LLMs) #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion cik_benchmark/baselines/direct_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from lmformatenforcer.integrations.transformers import (
build_transformers_prefix_allowed_tokens_fn,
)

import litellm
from .base import Baseline
from ..config import (
LLAMA31_405B_URL,
Expand Down Expand Up @@ -179,6 +179,19 @@ def openrouter_client(model, messages, n=1, max_tokens=10000, temperature=1.0):
return completion


def litellm_client(model, messages, n=1, max_tokens=10000, temperature=1.0):
"""
Client for litellm chat models
"""
completion = litellm.completion(
model=model,
messages=messages,
n=n,
max_tokens=max_tokens,
temperature=temperature,
)
return completion

def llama_3_1_405b_instruct_client(
model, messages, n=1, max_tokens=10000, temperature=1.0
):
Expand Down Expand Up @@ -328,6 +341,12 @@ def get_client(self):
temperature=self.temperature,
)

elif self.model.startswith("litellm-"):
return partial(
litellm_client,
temperature=self.temperature,
)

elif self.model in LLM_MAP.keys():
return partial(
huggingface_instruct_model_client,
Expand Down