From 456095c14b2c24e604abc83991ede3ecc43a5f03 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 19 Nov 2024 16:49:21 -0500 Subject: [PATCH 1/4] adding rerank docs and removing reference sections --- fern/docs.yml | 106 ++++++++-------- fern/docs/pages/options/reranker_models.mdx | 36 ++++++ ...ard-Prediction-Guard-API-1.0-resolved.yaml | 113 ++++++++++++++++++ 3 files changed, 203 insertions(+), 52 deletions(-) create mode 100644 fern/docs/pages/options/reranker_models.mdx diff --git a/fern/docs.yml b/fern/docs.yml index 62cc964..68b08b1 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -41,6 +41,8 @@ navigation: path: ./docs/pages/options/lvms.mdx - page: Embedding Models path: ./docs/pages/options/embedding_models.mdx + - page: Reranker Models + path: ./docs/pages/options/reranker_models.mdx - page: Enumerations path: ./docs/pages/options/enumerations.mdx - page: Prompt Formatting @@ -102,32 +104,32 @@ navigation: contents: - page: Enumerations for API path: ./docs/pages/options/enumerations.mdx - - section: SDK Reference - contents: - - page: Chat - path: ./docs/pages/reference/chat.mdx - - page: Chat SSE (Streaming) - path: ./docs/pages/reference/chat_sse.mdx - - page: Chat Vision - path: ./docs/pages/reference/chat_vision.mdx - - page: Completions - path: ./docs/pages/reference/completions.mdx - - page: Embeddings - path: ./docs/pages/reference/embeddings.mdx - # - page: Tokenize - # path: ./docs/pages/reference/tokenize.mdx - - page: Factuality - path: ./docs/pages/reference/factuality.mdx - - page: Injection - path: ./docs/pages/reference/injection.mdx - - page: PII - path: ./docs/pages/reference/PII.mdx - - page: Toxicity - path: ./docs/pages/reference/toxicity.mdx - - page: Translate - path: ./docs/pages/reference/translate.mdx - # - page: Models - # path: ./docs/pages/reference/models.mdx +# - section: SDK Reference +# contents: +# - page: Chat +# path: ./docs/pages/reference/chat.mdx +# - page: Chat SSE (Streaming) +# path: ./docs/pages/reference/chat_sse.mdx +# - page: Chat Vision +# path: ./docs/pages/reference/chat_vision.mdx +# - page: Completions +# path: ./docs/pages/reference/completions.mdx +# - page: Embeddings +# path: ./docs/pages/reference/embeddings.mdx +# - page: Tokenize +# path: ./docs/pages/reference/tokenize.mdx +# - page: Factuality +# path: ./docs/pages/reference/factuality.mdx +# - page: Injection +# path: ./docs/pages/reference/injection.mdx +# - page: PII +# path: ./docs/pages/reference/PII.mdx +# - page: Toxicity +# path: ./docs/pages/reference/toxicity.mdx +# - page: Translate +# path: ./docs/pages/reference/translate.mdx +# - page: Models +# path: ./docs/pages/reference/models.mdx - tab: sdk layout: @@ -137,32 +139,32 @@ navigation: path: ./docs/pages/sdks.mdx - page: Quick Start path: ./docs/pages/sdkquickstart.mdx - - section: SDK Reference - contents: - - page: Chat - path: ./docs/pages/reference/chat.mdx - - page: Chat SSE (Streaming) - path: ./docs/pages/reference/chat_sse.mdx - - page: Chat Vision - path: ./docs/pages/reference/chat_vision.mdx - - page: Completions - path: ./docs/pages/reference/completions.mdx - - page: Embeddings - path: ./docs/pages/reference/embeddings.mdx - # - page: Tokenize - # path: ./docs/pages/reference/tokenize.mdx - - page: Factuality - path: ./docs/pages/reference/factuality.mdx - - page: Injection - path: ./docs/pages/reference/injection.mdx - - page: PII - path: ./docs/pages/reference/PII.mdx - - page: Toxicity - path: ./docs/pages/reference/toxicity.mdx - - page: Translate - path: ./docs/pages/reference/translate.mdx - # - page: Models - # path: ./docs/pages/reference/models.mdx +# - section: SDK Reference +# contents: +# - page: Chat +# path: ./docs/pages/reference/chat.mdx +# - page: Chat SSE (Streaming) +# path: ./docs/pages/reference/chat_sse.mdx +# - page: Chat Vision +# path: ./docs/pages/reference/chat_vision.mdx +# - page: Completions +# path: ./docs/pages/reference/completions.mdx +# - page: Embeddings +# path: ./docs/pages/reference/embeddings.mdx +# - page: Tokenize +# path: ./docs/pages/reference/tokenize.mdx +# - page: Factuality +# path: ./docs/pages/reference/factuality.mdx +# - page: Injection +# path: ./docs/pages/reference/injection.mdx +# - page: PII +# path: ./docs/pages/reference/PII.mdx +# - page: Toxicity +# path: ./docs/pages/reference/toxicity.mdx +# - page: Translate +# path: ./docs/pages/reference/translate.mdx +# - page: Models +# path: ./docs/pages/reference/models.mdx redirects: - source: "/options/models" diff --git a/fern/docs/pages/options/reranker_models.mdx b/fern/docs/pages/options/reranker_models.mdx new file mode 100644 index 0000000..bcf8d28 --- /dev/null +++ b/fern/docs/pages/options/reranker_models.mdx @@ -0,0 +1,36 @@ +--- +title: Reranker Models +description: Reliable, future proof AI predictions +slug: options/reranker_models +--- + +This page provides information on the Reranker models that are available in the Prediction Guard API. +These models are designed for semantically ranking text, and are used in the `/rerank` endpoint. + +## Models + +| Model Name | Type | Use Case | Context Length | More Info | +| ---------------------- | ------------ | ----------------------------------------------- | -------------- | ------------------------------------------------------| +| bge-reranker-v2-m3 | Reranker | Used for semantically ranking queries | 512 | [link](/options/reranker_models#bge-reranker-v2-m3) | + +## Model Descriptions + +### bge-reranker-v2-m3 + +BAAI/bge-reranker-v2-m3 is a lightweight, multilingual reranker model designed for efficient and accurate text retrieval tasks. + +**Type:** Reranker\ +**Use Case:** Used for Semantically Ranking Documents + +https://huggingface.co/BAAI/bge-reranker-v2-m3 + +Unlike embedding models, rerankers take a query and document (or passage) as input and directly output a similarity score. +The output relevance score can be converted to a float value in the range [0,1] using a sigmoid function. + +Key Features: +• Multilingual Support: Excels across multiple languages with strong cross-lingual capabilities. +• Efficiency: Lightweight design ensures fast inference and easy deployment. +• Versatility: Supports a range of use cases and scenarios. + +This model offers an excellent balance between performance and deployment efficiency, +making it a powerful choice for a wide range of text retrieval scenarios. diff --git a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml index 86e9062..5c2dd1d 100644 --- a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml +++ b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml @@ -817,6 +817,119 @@ paths: security: - bearerAuth: [] + /rerank: + post: + summary: Rerank + description: Rerank sorts text inputs by semantic relevance to a specified query. + requestBody: + content: + application/json: + schema: + required: + - model + - query + - documents + type: object + properties: + model: + type: string + description: The model to use for reranking. + query: + type: string + description: The query to rank against. + documents: + type: array + description: Array of documents to rank. + items: + type: string + description: Documents to rank. + return_documents: + type: bool + description: Boolean setting whether to return documents in output. + examples: + basic: + summary: A text example of using the API. + value: + model: "bge-reranker-v2-m3" + query: "What is Deep Learning?" + documents: + - "Deep Learning is pizza." + - "Deep Learning is not pizza." + return_documents: true + responses: + "403": + description: Failed auth response. + content: + application/json: + schema: + type: object + properties: + error: + type: string + description: Description of the error. + example: + error: "api understands the request but refuses to authorize it" + "400": + description: General error response. + content: + application/json: + schema: + type: object + properties: + error: + type: string + description: Description of the error. + example: + error: "required fields are missing" + "200": + description: Successful response. + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique ID for the rerank response. + object: + type: string + description: Type of object (list). + created: + type: integer + description: Timestamp of when the rerank response was created. + model: + type: string + description: The rerank model used. + results: + type: array + description: The set of rankings. + items: + type: object + properties: + index: + type: integer + description: The index position in the collection. + relevance_score: + type: float + description: The relevance ranking score. + text: + type: string + description: The returned document + example: + id: "rerank-39bf1cf3-66cd-43d5-9185-b52baf742414" + object: "list" + created: 1732039610 + model: "bge-reranker-v2-m3" + results: + - index: 0 + relevance_score: 0.25128007 + text: "Deep Learning is not pizza." + - index: 1 + relevance_score: 0.5100618 + text: "Deep Learning is not pizza." + security: + - bearerAuth: [] + /tokenize: post: summary: Tokenize From f05dcf50a5aa21b014b4fc5f5ac31f3d81dbad5d Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 19 Nov 2024 16:53:19 -0500 Subject: [PATCH 2/4] fixing type name --- .../Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml index 5c2dd1d..223ade7 100644 --- a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml +++ b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml @@ -844,7 +844,7 @@ paths: type: string description: Documents to rank. return_documents: - type: bool + type: boolean description: Boolean setting whether to return documents in output. examples: basic: From fd7704f5b288e50f8f061c1d1a7c0707c3207f44 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 19 Nov 2024 16:56:56 -0500 Subject: [PATCH 3/4] fixing float to number --- .../Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml index 223ade7..2e09387 100644 --- a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml +++ b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml @@ -910,7 +910,7 @@ paths: type: integer description: The index position in the collection. relevance_score: - type: float + type: number description: The relevance ranking score. text: type: string @@ -1240,7 +1240,7 @@ paths: /PII: post: - summary: Replace Personal Information + summary: PII description: Replace personal information such as names, SSNs, and emails in a given text. requestBody: content: From fbf38ca2edbbff5737d81bd8623d239fad047259 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Wed, 20 Nov 2024 09:22:38 -0500 Subject: [PATCH 4/4] adding gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4223e7f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# JetBrains Folder +.idea