Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
eyurtsev committed Nov 22, 2024
1 parent 8511241 commit 906a0b2
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 105 deletions.
5 changes: 5 additions & 0 deletions libs/langchain/langchain/memory/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import Any, Dict, List, Type

from langchain_core._api import deprecated
from langchain_core.caches import BaseCache
from langchain_core.callbacks import Callbacks
from langchain_core.chat_history import BaseChatMessageHistory
from langchain_core.language_models import BaseLanguageModel
from langchain_core.messages import BaseMessage, SystemMessage, get_buffer_string
Expand Down Expand Up @@ -131,3 +133,6 @@ def clear(self) -> None:
"""Clear memory contents."""
super().clear()
self.buffer = ""


ConversationSummaryMemory.model_rebuild()
8 changes: 5 additions & 3 deletions libs/langchain/langchain/output_parsers/fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ class OutputFixingParser(BaseOutputParser[T]):
def is_lc_serializable(cls) -> bool:
return True

parser: Annotated[BaseOutputParser[T], SkipValidation()]
parser: Annotated[Any, SkipValidation()]
"""The parser to use to parse the output."""
# Should be an LLMChain but we want to avoid top-level imports from langchain.chains
retry_chain: Union[
RunnableSerializable[OutputFixingParserRetryChainInput, str], Any
retry_chain: Annotated[
Union[RunnableSerializable[OutputFixingParserRetryChainInput, str], Any],

SkipValidation(),
]
"""The RunnableSerializable to use to retry the completion (Legacy: LLMChain)."""
max_retries: int = 1
Expand Down
12 changes: 9 additions & 3 deletions libs/langchain/langchain/output_parsers/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ class RetryOutputParser(BaseOutputParser[T]):
parser: Annotated[BaseOutputParser[T], SkipValidation()]
"""The parser to use to parse the output."""
# Should be an LLMChain but we want to avoid top-level imports from langchain.chains
retry_chain: Union[RunnableSerializable[RetryOutputParserRetryChainInput, str], Any]
retry_chain: Annotated[
Union[RunnableSerializable[RetryOutputParserRetryChainInput, str], Any],
SkipValidation(),
]
"""The RunnableSerializable to use to retry the completion (Legacy: LLMChain)."""
max_retries: int = 1
"""The maximum number of times to retry the parse."""
Expand Down Expand Up @@ -187,8 +190,11 @@ class RetryWithErrorOutputParser(BaseOutputParser[T]):
parser: Annotated[BaseOutputParser[T], SkipValidation()]
"""The parser to use to parse the output."""
# Should be an LLMChain but we want to avoid top-level imports from langchain.chains
retry_chain: Union[
RunnableSerializable[RetryWithErrorOutputParserRetryChainInput, str], Any
retry_chain: Annotated[
Union[
RunnableSerializable[RetryWithErrorOutputParserRetryChainInput, str], Any
],
SkipValidation(),
]
"""The RunnableSerializable to use to retry the completion (Legacy: LLMChain)."""
max_retries: int = 1
Expand Down
Loading

0 comments on commit 906a0b2

Please sign in to comment.