-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput_parser.py
More file actions
27 lines (22 loc) · 879 Bytes
/
output_parser.py
File metadata and controls
27 lines (22 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from langchain.output_parsers import PydanticOutputParser
from pydantic import BaseModel, Field
from typing import List
class personIntel(BaseModel):
summary: str = Field(description="Summary of the person")
facts: List[str] = Field(description="Interesting facts about the person")
topics_of_interest: List[str] = Field(
description="Topics that may interest the person"
)
ice_breakers: List[str] = Field(
description="Create ice breakers to open a conversation with th person"
)
def to_dict(self):
return {
"summary": self.summary,
"facts": self.facts,
"topics_of_interest": self.topics_of_interest,
"ice_breakers": self.ice_breakers,
}
person_intel_parser: PydanticOutputParser = PydanticOutputParser(
pydantic_object=personIntel
)