|
| 1 | +openapi: 3.0.3 |
| 2 | +info: |
| 3 | + title: Evaluation API |
| 4 | + description: Provides endpoints for evaluating RAG systems using various metrics. |
| 5 | + contact: |
| 6 | + name: Pinecone Support |
| 7 | + url: https://support.pinecone.io |
| 8 | + email: support@pinecone.io |
| 9 | + version: 2025-01 |
| 10 | +servers: |
| 11 | +- url: https://prod-1-data.ke.pinecone.io/assistant |
| 12 | + description: Evaluation US Production API endpoints |
| 13 | +- url: https://prod-eu-data.ke.pinecone.io/assistant |
| 14 | + description: Evaluation EU Production API endpoints |
| 15 | +paths: |
| 16 | + /evaluation/metrics/alignment: |
| 17 | + post: |
| 18 | + tags: |
| 19 | + - Metrics |
| 20 | + summary: Evaluate an answer |
| 21 | + description: |- |
| 22 | + Evaluate the correctness and completeness of a response from an assistant or a RAG system. The correctness and completeness are evaluated based on the precision and recall of the generated answer with respect to the ground truth answer facts. Alignment is the harmonic mean of correctness and completeness. |
| 23 | +
|
| 24 | + For guidance and examples, see [Evaluate answers](https://docs.pinecone.io/guides/assistant/evaluate-answers). |
| 25 | + operationId: metrics_alignment |
| 26 | + requestBody: |
| 27 | + description: The request body for the alignment evaluation. |
| 28 | + content: |
| 29 | + application/json: |
| 30 | + schema: |
| 31 | + $ref: '#/components/schemas/AlignmentRequest' |
| 32 | + required: true |
| 33 | + responses: |
| 34 | + '200': |
| 35 | + description: The evaluation metrics and reasoning for the generated answer. |
| 36 | + content: |
| 37 | + application/json: |
| 38 | + schema: |
| 39 | + $ref: '#/components/schemas/AlignmentResponse' |
| 40 | + '422': |
| 41 | + description: Validation error. |
| 42 | + content: |
| 43 | + application/json: |
| 44 | + schema: |
| 45 | + $ref: '#/components/schemas/BasicErrorResponse' |
| 46 | + '500': |
| 47 | + description: Internal server error. |
| 48 | + content: |
| 49 | + application/json: |
| 50 | + schema: |
| 51 | + $ref: '#/components/schemas/BasicErrorResponse' |
| 52 | +components: |
| 53 | + schemas: |
| 54 | + AlignmentRequest: |
| 55 | + title: AlignmentRequest |
| 56 | + description: The request for the alignment evaluation. |
| 57 | + type: object |
| 58 | + properties: |
| 59 | + question: |
| 60 | + example: What is the capital city of Spain? |
| 61 | + title: Question |
| 62 | + description: The question for which the answer was generated. |
| 63 | + type: string |
| 64 | + answer: |
| 65 | + example: Barcelona. |
| 66 | + title: Answer |
| 67 | + description: The generated answer. |
| 68 | + type: string |
| 69 | + ground_truth_answer: |
| 70 | + example: Madrid. |
| 71 | + title: Ground Truth Answer |
| 72 | + description: The ground truth answer to the question. |
| 73 | + type: string |
| 74 | + required: |
| 75 | + - question |
| 76 | + - answer |
| 77 | + - ground_truth_answer |
| 78 | + additionalProperties: false |
| 79 | + AlignmentResponse: |
| 80 | + title: AlignmentResponse |
| 81 | + description: The response for the alignment evaluation. |
| 82 | + type: object |
| 83 | + properties: |
| 84 | + metrics: |
| 85 | + $ref: '#/components/schemas/Metrics' |
| 86 | + reasoning: |
| 87 | + $ref: '#/components/schemas/Reasoning' |
| 88 | + usage: |
| 89 | + $ref: '#/components/schemas/TokenCounts' |
| 90 | + required: |
| 91 | + - metrics |
| 92 | + - reasoning |
| 93 | + - usage |
| 94 | + additionalProperties: false |
| 95 | + BasicErrorResponse: |
| 96 | + title: BasicErrorResponse |
| 97 | + description: A basic error response that contains a message. |
| 98 | + type: object |
| 99 | + properties: |
| 100 | + message: |
| 101 | + title: Message |
| 102 | + type: string |
| 103 | + required: |
| 104 | + - message |
| 105 | + Entailment: |
| 106 | + title: Entailment |
| 107 | + description: The entailment of a fact. |
| 108 | + type: string |
| 109 | + enum: |
| 110 | + - entailed |
| 111 | + - contradicted |
| 112 | + - neutral |
| 113 | + EvaluatedFact: |
| 114 | + title: EvaluatedFact |
| 115 | + description: A fact that was evaluated. |
| 116 | + type: object |
| 117 | + properties: |
| 118 | + fact: |
| 119 | + $ref: '#/components/schemas/Fact' |
| 120 | + entailment: |
| 121 | + $ref: '#/components/schemas/Entailment' |
| 122 | + required: |
| 123 | + - fact |
| 124 | + - entailment |
| 125 | + additionalProperties: false |
| 126 | + Fact: |
| 127 | + title: Fact |
| 128 | + description: A fact |
| 129 | + type: object |
| 130 | + properties: |
| 131 | + content: |
| 132 | + title: Content |
| 133 | + description: The content of the fact. |
| 134 | + type: string |
| 135 | + required: |
| 136 | + - content |
| 137 | + additionalProperties: false |
| 138 | + Metrics: |
| 139 | + title: Metrics |
| 140 | + description: The metrics returned for the alignment evaluation. |
| 141 | + type: object |
| 142 | + properties: |
| 143 | + correctness: |
| 144 | + title: Correctness |
| 145 | + description: The precision of the generated answer. |
| 146 | + type: number |
| 147 | + completeness: |
| 148 | + title: Completeness |
| 149 | + description: The recall of the generated answer. |
| 150 | + type: number |
| 151 | + alignment: |
| 152 | + title: Alignment |
| 153 | + description: The harmonic mean of correctness and completeness. |
| 154 | + type: number |
| 155 | + required: |
| 156 | + - correctness |
| 157 | + - completeness |
| 158 | + - alignment |
| 159 | + additionalProperties: false |
| 160 | + Reasoning: |
| 161 | + title: Reasoning |
| 162 | + description: The reasoning behind the alignment evaluation. |
| 163 | + type: object |
| 164 | + properties: |
| 165 | + evaluated_facts: |
| 166 | + title: Evaluated Facts |
| 167 | + description: The facts that were evaluated. |
| 168 | + type: array |
| 169 | + items: |
| 170 | + $ref: '#/components/schemas/EvaluatedFact' |
| 171 | + required: |
| 172 | + - evaluated_facts |
| 173 | + additionalProperties: false |
| 174 | + TokenCounts: |
| 175 | + title: TokenCounts |
| 176 | + description: Token counts for the input prompt and completion. |
| 177 | + type: object |
| 178 | + properties: |
| 179 | + prompt_tokens: |
| 180 | + title: Prompt Tokens |
| 181 | + type: integer |
| 182 | + completion_tokens: |
| 183 | + title: Completion Tokens |
| 184 | + type: integer |
| 185 | + total_tokens: |
| 186 | + title: Total Tokens |
| 187 | + type: integer |
| 188 | + required: |
| 189 | + - prompt_tokens |
| 190 | + - completion_tokens |
| 191 | + - total_tokens |
| 192 | + securitySchemes: |
| 193 | + ApiKeyAuth: |
| 194 | + type: apiKey |
| 195 | + in: header |
| 196 | + name: Api-Key |
| 197 | + description: An API Key is required to call Pinecone APIs. Get yours from the [console](https://app.pinecone.io/). |
| 198 | +security: |
| 199 | +- ApiKeyAuth: [] |
| 200 | +tags: |
| 201 | +- name: Metrics |
| 202 | + description: Operations related to evaluation metrics calculation |
| 203 | +externalDocs: |
| 204 | + description: More Pinecone.io API docs |
| 205 | + url: https://docs.pinecone.io/introduction |
0 commit comments