Skip to content

Commit

Permalink
add new gpt-4 models + qroq
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Jun 15, 2024
1 parent d0dbc04 commit 005e053
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/funcchain/model/abilities.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
from langchain_core.language_models import BaseChatModel
from langchain_core.messages import HumanMessage, SystemMessage

from .patches.ollama import ChatOllama

verified_openai_function_models = [
"gpt-4",
"gpt-4o",
"gpt-4o-2024-05-13",
"gpt-4-0613",
"gpt-4-0125-preview",
"gpt-4-1106-preview",
"gpt-4-0106-preview",
"gpt-4-turbo-preview",
"gpt-4-32k",
"gpt-4-32k-0613",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-turbo-preview",
"gpt-3.5-turbo",
"gpt-3.5-turbo-0613",
"gpt-3.5-turbo-1106",
Expand All @@ -19,6 +23,10 @@
]

verified_openai_vision_models = [
"gpt-4o",
"gpt-4o-2024-05-13",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-vision-preview",
]

Expand Down Expand Up @@ -63,11 +71,18 @@ def gather_llm_type(llm: BaseChatModel, func_check: bool = True) -> str:
return "chat_model"
else:
return "function_model"
elif isinstance(llm, ChatOllama):
from .patches.ollama import ChatOllama

if isinstance(llm, ChatOllama):
for model in verified_ollama_vision_models:
if llm.model in model:
return "vision_model"

from langchain_groq import ChatGroq

if isinstance(llm, ChatGroq):
return "json_model"

return "chat_model"


Expand All @@ -77,6 +92,12 @@ def is_openai_function_model(
return gather_llm_type(llm) == "function_model"


def is_json_mode_model(
llm: BaseChatModel,
) -> bool:
return gather_llm_type(llm, func_check=False) == "json_model"


def is_vision_model(
llm: BaseChatModel,
) -> bool:
Expand Down

0 comments on commit 005e053

Please sign in to comment.