File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
from pydantic import BaseModel
2
2
from pydantic import Field
3
+ from typing import Optional
3
4
4
5
5
6
class Answer (BaseModel ):
6
7
"""A response representing an answer to a question on a forum."""
7
8
8
9
text : str = Field (description = "The main content of the answer." )
9
- author : str = Field (description = "A name string for the author of the answer." )
10
- upvoteCount : int = Field (description = "Number of upvotes on the answer." )
11
- downvoteCount : int = Field (description = "The number of downvotes on the answer." )
10
+ author : Optional [ str ] = Field (default = None , description = "A name string for the author of the answer." )
11
+ upvoteCount : Optional [ int ] = Field (default = None , description = "Number of upvotes on the answer." )
12
+ downvoteCount : Optional [ int ] = Field (default = None , description = "The number of downvotes on the answer." )
Original file line number Diff line number Diff line change 6
6
from pydantic import HttpUrl
7
7
8
8
from ..shared .meta_url import MetaUrl
9
+ from .answer import Answer
9
10
10
11
11
12
class QAPage (BaseModel ):
12
13
"""Aggreated result from a question answer page."""
13
14
14
15
question : str = Field (description = "The question being asked." )
15
- answer : str = Field (description = "The answer to the question." )
16
+ answer : Answer = Field (description = "The answer to the question." )
16
17
17
18
18
19
class QA (BaseModel ):
Original file line number Diff line number Diff line change 22
22
from .book import Book
23
23
from .faq import FAQ
24
24
from .faq import QA
25
+ from .faq import QAPage
25
26
from .location_result import LocationResult
26
27
from .location_result import Locations
27
28
from .product import Product
@@ -66,7 +67,7 @@ class SearchResult(Result):
66
67
faq : Optional [FAQ ] = Field (
67
68
default = None , description = "Any frequently asked questions associated with the web search result."
68
69
)
69
- qa : Optional [QA ] = Field (
70
+ qa : Optional [QAPage ] = Field (
70
71
default = None , description = "Any question answer information associated with the web search result page."
71
72
)
72
73
book : Optional [Book ] = Field (
You can’t perform that action at this time.
0 commit comments