GoogleTextSynthesizer #
基类: BaseSynthesizer
Google 的归因式问答服务。
给定用户的查询和通道列表,Google 的服务器将返回一个基于提供的通道列表的响应。它不会基于参数记忆生成响应。
源码位于 llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/base.py
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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
from_defaults classmethod
#
from_defaults(temperature: float = 0.7, answer_style: int = 1, safety_setting: List[SafetySetting] = []) -> GoogleTextSynthesizer
创建一个新的 Google AQA。
示例
responder = GoogleTextSynthesizer.create( temperature=0.7, answer_style=AnswerStyle.ABSTRACTIVE, safety_setting=[ SafetySetting( category=HARM_CATEGORY_SEXUALLY_EXPLICIT, threshold=HarmBlockThreshold.BLOCK_LOW_AND_ABOVE, ), ] )
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
temperature
|
float
|
0.0 到 1.0。 |
0.7
|
answer_style
|
int
|
参见 |
1
|
safety_setting
|
List[SafetySetting]
|
参见 |
[]
|
返回
类型 | 描述 |
---|---|
GoogleTextSynthesizer
|
一个 GoogleTextSynthesizer 实例。 |
源码位于 llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/base.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
get_response #
get_response(query_str: str, text_chunks: Sequence[str], **response_kwargs: Any) -> SynthesizedResponse
基于提供的通道生成一个 grounded (有根据的) 响应。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query_str
|
str
|
用户的提问。 |
required |
text_chunks
|
Sequence[str]
|
应用于回答问题的通道列表。 |
required |
返回
类型 | 描述 |
---|---|
SynthesizedResponse
|
一个 |
源码位于 llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/base.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
synthesize #
synthesize(query: QueryTextType, nodes: List[NodeWithScore], additional_source_nodes: Optional[Sequence[NodeWithScore]] = None, **response_kwargs: Any) -> Response
基于提供的通道返回一个 grounded (有根据的) 响应。
返回
类型 | 描述 |
---|---|
响应
|
响应的 |
响应
|
这些通道是用于构建 grounded 响应的通道。 |
响应
|
这些通道将始终没有得分,这是标记它们为归因通道的唯一方法。 |
响应
|
然后,列表将跟随原始提供的通道,这些通道将 |
响应
|
具有检索得出的得分。 |
响应
|
检索得出的得分。 |
响应
|
响应的 |
响应
|
这是模型对其答案在输入通道中是正确且有根据的 |
响应
|
概率的估计。 |
响应
|
概率的估计。 |
源码位于 llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/base.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|