-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathquestion.py
More file actions
109 lines (77 loc) · 2.97 KB
/
question.py
File metadata and controls
109 lines (77 loc) · 2.97 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import List, Optional
from pydantic import Field as FieldInfo
from .._models import BaseModel
from .shared.source import Source
__all__ = ["Question", "References", "ReferencesFile", "ReferencesWeb", "Subquery"]
class ReferencesFile(BaseModel):
"""
A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.
"""
file_id: str = FieldInfo(alias="fileId")
"""The unique identifier of the file in your Writer account."""
score: float
"""
Internal score used during the retrieval process for ranking and selecting
relevant snippets.
"""
text: str
"""
The exact text snippet from the source document that was used to support the
response.
"""
cite: Optional[str] = None
"""
Unique citation ID that appears in inline citations within the response text
(null if not cited).
"""
page: Optional[int] = None
"""Page number where this snippet was found in the source document."""
class ReferencesWeb(BaseModel):
"""
A web-based reference containing text snippets from online sources accessed during the query.
"""
score: float
"""
Internal score used during the retrieval process for ranking and selecting
relevant snippets.
"""
text: str
"""
The exact text snippet from the web source that was used to support the
response.
"""
title: str
"""The title of the web page where this content was found."""
url: str
"""The URL of the web page where this content was found."""
class References(BaseModel):
"""
Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.
"""
files: Optional[List[ReferencesFile]] = None
"""Array of file-based references from uploaded documents in the Knowledge Graph."""
web: Optional[List[ReferencesWeb]] = None
"""Array of web-based references from online sources accessed during the query."""
class Subquery(BaseModel):
"""
A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.
"""
answer: str
"""The answer to the subquery based on Knowledge Graph content."""
query: str
"""The subquery that was generated to help answer the main question."""
sources: List[Optional[Source]]
"""Array of source snippets that were used to answer this subquery."""
class Question(BaseModel):
answer: str
"""The answer to the question."""
question: str
"""The question that was asked."""
sources: List[Optional[Source]]
references: Optional[References] = None
"""
Detailed source information organized by reference type, providing comprehensive
metadata about the sources used to generate the response.
"""
subqueries: Optional[List[Optional[Subquery]]] = None