mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-14 17:07:25 +00:00
fix: lint/format (#31894)
This commit is contained in:
parent
03e8327e01
commit
6c23c711fb
@ -167,6 +167,7 @@ class ConversationVectorStoreTokenBufferMemory(ConversationTokenBufferMemory):
|
|||||||
self._pop_and_store_interaction(buffer)
|
self._pop_and_store_interaction(buffer)
|
||||||
|
|
||||||
def _pop_and_store_interaction(self, buffer: list[BaseMessage]) -> None:
|
def _pop_and_store_interaction(self, buffer: list[BaseMessage]) -> None:
|
||||||
|
input_ = buffer.pop(0)
|
||||||
output = buffer.pop(0)
|
output = buffer.pop(0)
|
||||||
timestamp = self._timestamps.pop(0).strftime(TIMESTAMP_FORMAT)
|
timestamp = self._timestamps.pop(0).strftime(TIMESTAMP_FORMAT)
|
||||||
# Split AI output into smaller chunks to avoid creating documents
|
# Split AI output into smaller chunks to avoid creating documents
|
||||||
@ -174,7 +175,7 @@ class ConversationVectorStoreTokenBufferMemory(ConversationTokenBufferMemory):
|
|||||||
ai_chunks = self._split_long_ai_text(str(output.content))
|
ai_chunks = self._split_long_ai_text(str(output.content))
|
||||||
for index, chunk in enumerate(ai_chunks):
|
for index, chunk in enumerate(ai_chunks):
|
||||||
self.memory_retriever.save_context(
|
self.memory_retriever.save_context(
|
||||||
{"Human": f"<{timestamp}/00> {input.content!s}"},
|
{"Human": f"<{timestamp}/00> {input_.content!s}"},
|
||||||
{"AI": f"<{timestamp}/{index:02}> {chunk}"},
|
{"AI": f"<{timestamp}/{index:02}> {chunk}"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class OutputFixingParser(BaseOutputParser[T]):
|
|||||||
try:
|
try:
|
||||||
completion = self.retry_chain.invoke(
|
completion = self.retry_chain.invoke(
|
||||||
{
|
{
|
||||||
"instructions": self.parser.get_format_instructions(), # noqa: E501
|
"instructions": self.parser.get_format_instructions(),
|
||||||
"completion": completion,
|
"completion": completion,
|
||||||
"error": repr(e),
|
"error": repr(e),
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ class OutputFixingParser(BaseOutputParser[T]):
|
|||||||
try:
|
try:
|
||||||
completion = await self.retry_chain.ainvoke(
|
completion = await self.retry_chain.ainvoke(
|
||||||
{
|
{
|
||||||
"instructions": self.parser.get_format_instructions(), # noqa: E501
|
"instructions": self.parser.get_format_instructions(),
|
||||||
"completion": completion,
|
"completion": completion,
|
||||||
"error": repr(e),
|
"error": repr(e),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user