mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
* Add cohere v2/rerank support (#8421) * Support v2 endpoint cohere rerank * Add tests and docs * Make v1 default if old params used * Update docs * Update docs pt 2 * Update tests * Add e2e test * Clean up code * Use inheritence for new config * Fix linting issues (#8608) * Fix cohere v2 failing test + linting (#8672) * Fix test and unused imports * Fix tests * fix: fix linting errors * test: handle tgai instability * fix: skip service unavailable err * test: print logs for unstable test * test: skip unreliable tests --------- Co-authored-by: vibhavbhat <vibhavb00@gmail.com>
This commit is contained in:
parent
c2aec21b4d
commit
09462ba80c
19 changed files with 257 additions and 40 deletions
|
@ -15,6 +15,7 @@ def get_optional_rerank_params(
|
|||
rank_fields: Optional[List[str]] = None,
|
||||
return_documents: Optional[bool] = True,
|
||||
max_chunks_per_doc: Optional[int] = None,
|
||||
max_tokens_per_doc: Optional[int] = None,
|
||||
non_default_params: Optional[dict] = None,
|
||||
) -> OptionalRerankParams:
|
||||
all_non_default_params = non_default_params or {}
|
||||
|
@ -28,6 +29,8 @@ def get_optional_rerank_params(
|
|||
all_non_default_params["return_documents"] = return_documents
|
||||
if max_chunks_per_doc is not None:
|
||||
all_non_default_params["max_chunks_per_doc"] = max_chunks_per_doc
|
||||
if max_tokens_per_doc is not None:
|
||||
all_non_default_params["max_tokens_per_doc"] = max_tokens_per_doc
|
||||
return rerank_provider_config.map_cohere_rerank_params(
|
||||
model=model,
|
||||
drop_params=drop_params,
|
||||
|
@ -38,5 +41,6 @@ def get_optional_rerank_params(
|
|||
rank_fields=rank_fields,
|
||||
return_documents=return_documents,
|
||||
max_chunks_per_doc=max_chunks_per_doc,
|
||||
max_tokens_per_doc=max_tokens_per_doc,
|
||||
non_default_params=all_non_default_params,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue