mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
3f6bf852ea
Added missed docstrings. Formatted docsctrings to the consistent format.
26 lines
504 B
Python
26 lines
504 B
Python
from __future__ import annotations
|
|
|
|
from enum import Enum
|
|
from typing import Set
|
|
|
|
from langchain_experimental.pydantic_v1 import BaseModel, Field
|
|
|
|
|
|
class ThoughtValidity(Enum):
|
|
"""Enum for the validity of a thought."""
|
|
|
|
VALID_INTERMEDIATE = 0
|
|
VALID_FINAL = 1
|
|
INVALID = 2
|
|
|
|
|
|
class Thought(BaseModel):
|
|
"""A thought in the ToT."""
|
|
|
|
text: str
|
|
validity: ThoughtValidity
|
|
children: Set[Thought] = Field(default_factory=set)
|
|
|
|
def __hash__(self) -> int:
|
|
return id(self)
|