mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
add basic cohere rerank
This commit is contained in:
parent
6ab8cbc105
commit
3a82334762
2 changed files with 21 additions and 0 deletions
|
|
@ -934,6 +934,7 @@ from .proxy.proxy_cli import run_server
|
|||
from .router import Router
|
||||
from .assistants.main import *
|
||||
from .batches.main import *
|
||||
from .rerank_api.main import *
|
||||
from .fine_tuning.main import *
|
||||
from .files.main import *
|
||||
from .scheduler import *
|
||||
|
|
|
|||
20
litellm/rerank_api/types.py
Normal file
20
litellm/rerank_api/types.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"""
|
||||
LiteLLM Follows the cohere API format for the re rank API
|
||||
https://docs.cohere.com/reference/rerank
|
||||
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class RerankRequest(BaseModel):
|
||||
model: str
|
||||
query: str
|
||||
top_n: int
|
||||
documents: list[str]
|
||||
|
||||
|
||||
class RerankResponse(BaseModel):
|
||||
id: str
|
||||
results: list[dict] # Contains index and relevance_score
|
||||
meta: dict # Contains api_version and billed_units
|
||||
Loading…
Add table
Reference in a new issue