From 95ae40ff906437323136f175bfe709556d6d2d5c Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Tue, 24 Oct 2023 10:07:01 -0700 Subject: [PATCH] Fix Anthropic Functions ainvoke (#12215) Removes custom `NotImplementedError` in experimental anthropic functions, allowing it to fallback on default `ainvoke` implementation. --- .../llms/anthropic_functions.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/libs/experimental/langchain_experimental/llms/anthropic_functions.py b/libs/experimental/langchain_experimental/llms/anthropic_functions.py index 68e0eac1f8b..48e38690dea 100644 --- a/libs/experimental/langchain_experimental/llms/anthropic_functions.py +++ b/libs/experimental/langchain_experimental/llms/anthropic_functions.py @@ -5,14 +5,12 @@ from typing import Any, DefaultDict, Dict, List, Optional from langchain.callbacks.manager import ( CallbackManagerForLLMRun, - Callbacks, ) from langchain.chat_models.anthropic import ChatAnthropic from langchain.chat_models.base import BaseChatModel from langchain.schema import ( ChatGeneration, ChatResult, - LLMResult, ) from langchain.schema.messages import ( AIMessage, @@ -196,18 +194,6 @@ class AnthropicFunctions(BaseChatModel): else: return ChatResult(generations=[ChatGeneration(message=response)]) - async def agenerate( - self, - messages: List[List[BaseMessage]], - stop: Optional[List[str]] = None, - callbacks: Callbacks = None, - *, - tags: Optional[List[str]] = None, - metadata: Optional[Dict[str, Any]] = None, - **kwargs: Any, - ) -> LLMResult: - raise NotImplementedError - @property def _llm_type(self) -> str: return "anthropic_functions"