-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinference.oas.yaml
446 lines (443 loc) · 14.4 KB
/
inference.oas.yaml
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
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
openapi: 3.0.3
info:
title: Pinecone Inference API
description: Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
contact:
name: Pinecone Support
url: https://support.pinecone.io
email: [email protected]
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
version: 2025-01
servers:
- url: https://api.pinecone.io
description: Production API endpoints
paths:
/embed:
post:
tags:
- Inference
summary: Generate vectors
description: |-
Generate vector embeddings for input data. This endpoint uses [Pinecone Inference](https://docs.pinecone.io/guides/inference/understanding-inference).
For guidance and examples, see [Embed data](https://docs.pinecone.io/guides/inference/generate-embeddings).
operationId: embed
requestBody:
description: Generate embeddings for inputs.
content:
application/json:
schema:
$ref: '#/components/schemas/EmbedRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/EmbeddingsList'
'400':
description: Bad request. The request body included invalid request parameters.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
index-metric-validation-error:
summary: Validation error
value:
error:
code: INVALID_ARGUMENT
message: Bad request. The request body included invalid request parameters.
status: 400
'401':
description: 'Unauthorized. Possible causes: Invalid API key.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
unauthorized:
summary: Unauthorized
value:
error:
code: UNAUTHENTICATED
message: Invalid API key.
status: 401
'500':
description: Internal server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
internal-server-error:
summary: Internal server error
value:
error:
code: UNKNOWN
message: Internal server error
status: 500
/rerank:
post:
tags:
- Inference
summary: Rerank results
description: |-
Rerank query results according to their relevance to a query. This endpoint uses [Pinecone Inference](https://docs.pinecone.io/guides/inference/understanding-inference).
For guidance and examples, see [Rerank documents](https://docs.pinecone.io/guides/inference/rerank).
operationId: rerank
requestBody:
description: Rerank documents for the given query
content:
application/json:
schema:
$ref: '#/components/schemas/RerankRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/RerankResult'
'400':
description: Bad request. The request body included invalid request parameters.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
index-metric-validation-error:
summary: Validation error
value:
error:
code: INVALID_ARGUMENT
message: Bad request. The request body included invalid request parameters.
status: 400
'401':
description: 'Unauthorized. Possible causes: Invalid API key.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
unauthorized:
summary: Unauthorized
value:
error:
code: UNAUTHENTICATED
message: Invalid API key.
status: 401
'500':
description: Internal server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
internal-server-error:
summary: Internal server error
value:
error:
code: UNKNOWN
message: Internal server error
status: 500
components:
schemas:
RerankRequest:
type: object
properties:
model:
example: bge-reranker-v2-m3
description: The [model](https://docs.pinecone.io/guides/inference/understanding-inference#reranking-models) to use for reranking.
type: string
query:
example: What is the capital of France?
description: The query to rerank documents against.
type: string
top_n:
example: 5
description: The number of results to return sorted by relevance. Defaults to the number of inputs.
type: integer
return_documents:
example: true
description: Whether to return the documents in the response.
default: true
type: boolean
rank_fields:
description: |
The field(s) to consider for reranking. If not provided, the default is `["text"]`.
The number of fields supported is [model-specific](https://docs.pinecone.io/guides/inference/understanding-inference#reranking-models).
default:
- text
type: array
items:
type: string
documents:
description: The documents to rerank.
type: array
items:
$ref: '#/components/schemas/Document'
parameters:
example:
truncate: END
description: Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#reranking-models) for available model parameters.
type: object
additionalProperties: true
required:
- model
- documents
- query
SparseEmbedding:
description: A sparse embedding of a single input
type: object
properties:
sparse_values:
example:
- 0.1
- 0.2
- 0.3
description: The sparse embedding values.
type: array
items:
type: number
format: float
sparse_indices:
example:
- 10
- 3
- 156
description: The sparse embedding indices.
type: array
items:
type: integer
format: int32
minimum: 0
sparse_tokens:
example:
- quick
- brown
- fox
description: The normalized tokens used to create the sparse embedding.
type: array
items:
type: string
vector_type:
$ref: '#/components/schemas/VectorType'
required:
- sparse_values
- sparse_indices
- vector_type
RerankResult:
description: The result of a reranking request.
type: object
properties:
model:
example: bge-reranker-v2-m3
description: The model used to rerank documents.
type: string
data:
description: The reranked documents.
type: array
items:
$ref: '#/components/schemas/RankedDocument'
usage:
description: Usage statistics for the model inference.
type: object
properties:
rerank_units:
example: 1
description: The number of rerank units consumed by this operation.
type: integer
format: int32
minimum: 0
required:
- model
- data
- usage
RankedDocument:
description: A ranked document with a relevance score and an index position.
type: object
properties:
index:
description: The index position of the document from the original request.
type: integer
score:
example: 0.5
description: The relevance of the document to the query, normalized between 0 and 1, with scores closer to 1 indicating higher relevance.
type: number
document:
$ref: '#/components/schemas/Document'
required:
- index
- score
EmbedRequest:
type: object
properties:
model:
example: multilingual-e5-large
description: The [model](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) to use for embedding generation.
type: string
parameters:
example:
input_type: passage
truncate: END
description: Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) for available model parameters.
type: object
additionalProperties: true
inputs:
description: List of inputs to generate embeddings for.
type: array
items:
type: object
properties:
text:
example: The quick brown fox jumps over the lazy dog.
type: string
required:
- model
- inputs
VectorType:
description: Indicates whether this is a 'dense' or 'sparse' embedding.
type: string
enum:
- dense
- sparse
DenseEmbedding:
description: A dense embedding of a single input
type: object
properties:
values:
example:
- 0.1
- 0.2
- 0.3
description: The dense embedding values.
type: array
items:
type: number
format: float
vector_type:
$ref: '#/components/schemas/VectorType'
required:
- values
- vector_type
EmbeddingsList:
description: Embeddings generated for the input.
type: object
properties:
model:
example: multilingual-e5-large
description: The model used to generate the embeddings
type: string
vector_type:
example: dense
description: Indicates whether the response data contains 'dense' or 'sparse' embeddings.
type: string
data:
description: The embeddings generated for the inputs.
type: array
items:
$ref: '#/components/schemas/Embedding'
usage:
description: Usage statistics for the model inference.
type: object
properties:
total_tokens:
example: 205
description: Total number of tokens consumed across all inputs.
type: integer
format: int32
minimum: 0
required:
- model
- vector_type
- data
- usage
Document:
example:
id: '1'
text: Paris is the capital of France.
title: France
url: https://example.com
description: Document for reranking
type: object
additionalProperties: true
ErrorResponse:
example:
error:
code: QUOTA_EXCEEDED
message: The index exceeds the project quota of 5 pods by 2 pods. Upgrade your account or change the project settings to increase the quota.
status: 429
description: The response shape used for all error responses.
type: object
properties:
status:
example: 500
description: The HTTP status code of the error.
type: integer
error:
example:
code: INVALID_ARGUMENT
message: Index name must contain only lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen.
description: Detailed information about the error that occurred.
type: object
properties:
code:
type: string
enum:
- OK
- UNKNOWN
- INVALID_ARGUMENT
- DEADLINE_EXCEEDED
- QUOTA_EXCEEDED
- NOT_FOUND
- ALREADY_EXISTS
- PERMISSION_DENIED
- UNAUTHENTICATED
- RESOURCE_EXHAUSTED
- FAILED_PRECONDITION
- ABORTED
- OUT_OF_RANGE
- UNIMPLEMENTED
- INTERNAL
- UNAVAILABLE
- DATA_LOSS
- FORBIDDEN
message:
example: Index name must contain only lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen.
type: string
details:
description: Additional information about the error. This field is not guaranteed to be present.
type: object
required:
- code
- message
required:
- status
- error
Embedding:
description: Embedding of a single input
discriminator:
propertyName: vector_type
mapping:
dense: '#/components/schemas/DenseEmbedding'
sparse: '#/components/schemas/SparseEmbedding'
type: object
oneOf:
- $ref: '#/components/schemas/DenseEmbedding'
- $ref: '#/components/schemas/SparseEmbedding'
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: Api-Key
description: An API Key is required to call Pinecone APIs. Get yours from the [console](https://app.pinecone.io/).
security:
- ApiKeyAuth: []
tags:
- name: Inference
description: Model inference
externalDocs:
description: More Pinecone.io API docs
url: https://docs.pinecone.io/introduction