General anthropic functions, steps towards experimental integration tests (#11727)

To match change in js here
https://github.com/langchain-ai/langchainjs/pull/2892

Some integration tests need a bit more work in experimental:
![Screenshot 2023-10-12 at 12 02 49
PM](https://github.com/langchain-ai/langchain/assets/9557659/262d7d22-c405-40e9-afef-669e8d585307)

Pretty sure the sqldatabase ones are an actual regression or change in
interface because it's returning a placeholder.

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
Erick Friis
2023-10-13 09:48:24 -07:00
committed by GitHub
parent 98c8516ef1
commit 1861cc7100
7 changed files with 128 additions and 7 deletions

View File

@@ -124,11 +124,17 @@ def _destrip(tool_input: Any) -> Any:
class AnthropicFunctions(BaseChatModel):
model: ChatAnthropic
llm: BaseChatModel
@root_validator(pre=True)
def validate_environment(cls, values: Dict) -> Dict:
return {"model": ChatAnthropic(**values)}
values["llm"] = values.get("llm") or ChatAnthropic(**values)
return values
@property
def model(self) -> BaseChatModel:
"""For backwards compatibility."""
return self.llm
def _generate(
self,