mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
2673b3a314
Create pydantic v1 namespace in langchain experimental
22 lines
401 B
Python
22 lines
401 B
Python
from __future__ import annotations
|
|
|
|
from enum import Enum
|
|
from typing import Set
|
|
|
|
from pydantic_v1 import BaseModel, Field
|
|
|
|
|
|
class ThoughtValidity(Enum):
|
|
VALID_INTERMEDIATE = 0
|
|
VALID_FINAL = 1
|
|
INVALID = 2
|
|
|
|
|
|
class Thought(BaseModel):
|
|
text: str
|
|
validity: ThoughtValidity
|
|
children: Set[Thought] = Field(default_factory=set)
|
|
|
|
def __hash__(self) -> int:
|
|
return id(self)
|