mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-03 11:47:49 +00:00
Fix Anthropic Functions ainvoke (#12215)
Removes custom `NotImplementedError` in experimental anthropic functions, allowing it to fallback on default `ainvoke` implementation.
This commit is contained in:
parent
d5d7ba582a
commit
95ae40ff90
@ -5,14 +5,12 @@ from typing import Any, DefaultDict, Dict, List, Optional
|
|||||||
|
|
||||||
from langchain.callbacks.manager import (
|
from langchain.callbacks.manager import (
|
||||||
CallbackManagerForLLMRun,
|
CallbackManagerForLLMRun,
|
||||||
Callbacks,
|
|
||||||
)
|
)
|
||||||
from langchain.chat_models.anthropic import ChatAnthropic
|
from langchain.chat_models.anthropic import ChatAnthropic
|
||||||
from langchain.chat_models.base import BaseChatModel
|
from langchain.chat_models.base import BaseChatModel
|
||||||
from langchain.schema import (
|
from langchain.schema import (
|
||||||
ChatGeneration,
|
ChatGeneration,
|
||||||
ChatResult,
|
ChatResult,
|
||||||
LLMResult,
|
|
||||||
)
|
)
|
||||||
from langchain.schema.messages import (
|
from langchain.schema.messages import (
|
||||||
AIMessage,
|
AIMessage,
|
||||||
@ -196,18 +194,6 @@ class AnthropicFunctions(BaseChatModel):
|
|||||||
else:
|
else:
|
||||||
return ChatResult(generations=[ChatGeneration(message=response)])
|
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
|
@property
|
||||||
def _llm_type(self) -> str:
|
def _llm_type(self) -> str:
|
||||||
return "anthropic_functions"
|
return "anthropic_functions"
|
||||||
|
Loading…
Reference in New Issue
Block a user