This commit is contained in:
Mason Daugherty 2025-07-06 22:17:37 -04:00
parent 18824b5761
commit 57fd8887d8
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
from typing import Literal
from typing import Literal, Optional
from langchain_core.agents import AgentAction
@ -21,7 +21,7 @@ def _escape(xml: str) -> str:
def format_xml(
intermediate_steps: list[tuple[AgentAction, str]],
*,
escape_format: Literal["minimal"] | None = "minimal",
escape_format: Optional[Literal["minimal"]] = "minimal",
) -> str:
"""Format the intermediate steps as XML.

View File

@ -1,5 +1,5 @@
import re
from typing import Literal, Union
from typing import Literal, Union, Optional
from langchain_core.agents import AgentAction, AgentFinish
from pydantic import Field
@ -56,7 +56,7 @@ class XMLAgentOutputParser(AgentOutputParser):
contains malformed XML structure.
"""
escape_format: Literal["minimal"] | None = Field(default="minimal")
escape_format: Optional[Literal["minimal"]] = Field(default="minimal")
"""The format to use for escaping XML characters.
minimal - uses custom delimiters to replace XML tags within content,