From ad7dfd2edbe5e9b30fbff06b0913e1003654bd68 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 19 Dec 2024 18:51:55 -0800 Subject: [PATCH] docs infinity rerank api docs --- docs/my-website/docs/providers/infinity.md | 67 ++++++++++++++++++++++ docs/my-website/docs/rerank.md | 3 +- docs/my-website/sidebars.js | 1 + 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 docs/my-website/docs/providers/infinity.md diff --git a/docs/my-website/docs/providers/infinity.md b/docs/my-website/docs/providers/infinity.md new file mode 100644 index 0000000000..dd6986dfef --- /dev/null +++ b/docs/my-website/docs/providers/infinity.md @@ -0,0 +1,67 @@ +# Infinity + +| Property | Details | +|-------|-------| +| Description | Infinity is a high-throughput, low-latency REST API for serving text-embeddings, reranking models and clip| +| Provider Route on LiteLLM | `infinity/` | +| Supported Operations | `/rerank` | +| Link to Provider Doc | [Infinity ↗](https://github.com/michaelfeil/infinity) | + + +## **Usage - LiteLLM Python SDK** + +```python +from litellm import rerank + +response = rerank( + model="infinity/rerank", + query="What is the capital of France?", + documents=["Paris", "London", "Berlin", "Madrid"], +) +``` + +## **Usage - LiteLLM Proxy** + +LiteLLM provides an cohere api compatible `/rerank` endpoint for Rerank calls. + +**Setup** + +Add this to your litellm proxy config.yaml + +```yaml +model_list: + - model_name: custom-infinity-rerank + litellm_params: + model: infinity/rerank + api_key: os.environ/INFINITY_API_KEY + api_base: https://localhost:8080 +``` + +Start litellm + +```bash +litellm --config /path/to/config.yaml + +# RUNNING on http://0.0.0.0:4000 +``` + +Test request + +```bash +curl http://0.0.0.0:4000/rerank \ + -H "Authorization: Bearer sk-1234" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "custom-infinity-rerank", + "query": "What is the capital of the United States?", + "documents": [ + "Carson City is the capital city of the American state of Nevada.", + "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", + "Washington, D.C. is the capital of the United States.", + "Capital punishment has existed in the United States since before it was a country." + ], + "top_n": 3 + }' +``` + + diff --git a/docs/my-website/docs/rerank.md b/docs/my-website/docs/rerank.md index b630a8cd8d..598c672942 100644 --- a/docs/my-website/docs/rerank.md +++ b/docs/my-website/docs/rerank.md @@ -115,4 +115,5 @@ curl http://0.0.0.0:4000/rerank \ | Together AI| [Usage](../docs/providers/togetherai) | | Azure AI| [Usage](../docs/providers/azure_ai) | | Jina AI| [Usage](../docs/providers/jina_ai) | -| AWS Bedrock| [Usage](../docs/providers/bedrock#rerank-api) | \ No newline at end of file +| AWS Bedrock| [Usage](../docs/providers/bedrock#rerank-api) | +| Infinity| [Usage](../docs/providers/infinity) | \ No newline at end of file diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index 931b0ecebe..90256deabf 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -186,6 +186,7 @@ const sidebars = { "providers/fireworks_ai", "providers/clarifai", "providers/vllm", + "providers/infinity", "providers/xinference", "providers/cloudflare_workers", "providers/deepinfra",