Skip to content

Commit

Permalink
Handle models like openai/bedrock/claude-3.5-... (#2869)
Browse files Browse the repository at this point in the history
* Handle models like openai/bedrock/claude-3.5-...

* Fix log statement
  • Loading branch information
Weves authored Oct 22, 2024
1 parent e4779c2 commit 6e9b6a1
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions backend/danswer/llm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,26 @@ def get_llm_max_tokens(

try:
model_obj = model_map.get(f"{model_provider}/{model_name}")
if not model_obj:
model_obj = model_map[model_name]
logger.debug(f"Using model object for {model_name}")
else:
if model_obj:
logger.debug(f"Using model object for {model_provider}/{model_name}")

if not model_obj:
model_obj = model_map.get(model_name)
if model_obj:
logger.debug(f"Using model object for {model_name}")

if not model_obj:
model_name_split = model_name.split("/")
if len(model_name_split) > 1:
model_obj = model_map.get(model_name_split[1])
if model_obj:
logger.debug(f"Using model object for {model_name_split[1]}")

if not model_obj:
raise RuntimeError(
f"No litellm entry found for {model_provider}/{model_name}"
)

if "max_input_tokens" in model_obj:
max_tokens = model_obj["max_input_tokens"]
logger.info(
Expand Down

0 comments on commit 6e9b6a1

Please sign in to comment.