mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
d96f67b06f
- Refactor standard test classes to make them easier to configure - Update openai to support stop_sequences init param - Update groq to support stop_sequences init param - Update fireworks to support max_retries init param - Update ChatModel.bind_tools to type tool_choice - Update groq to handle tool_choice="any". **this may be controversial** --------- Co-authored-by: Chester Curme <chester.curme@gmail.com>
28 lines
795 B
Python
28 lines
795 B
Python
"""Standard LangChain interface tests"""
|
|
|
|
from typing import Type
|
|
|
|
from langchain_core.language_models import BaseChatModel
|
|
from langchain_core.runnables import RunnableBinding
|
|
from langchain_standard_tests.unit_tests.chat_models import (
|
|
ChatModelUnitTests,
|
|
Person,
|
|
my_adder_tool,
|
|
)
|
|
|
|
from langchain_groq import ChatGroq
|
|
|
|
|
|
class TestGroqStandard(ChatModelUnitTests):
|
|
@property
|
|
def chat_model_class(self) -> Type[BaseChatModel]:
|
|
return ChatGroq
|
|
|
|
def test_bind_tool_pydantic(self, model: BaseChatModel) -> None:
|
|
"""Does not currently support tool_choice='any'."""
|
|
if not self.has_tool_calling:
|
|
return
|
|
|
|
tool_model = model.bind_tools([Person, Person.schema(), my_adder_tool])
|
|
assert isinstance(tool_model, RunnableBinding)
|