(Refactor) Code Quality improvement - Use Common base handler for cloudflare/ provider (#7127)

* add get_complete_url to base config

* cloudflare - refactor to following existing pattern

* migrate cloudflare chat completions to base llm http handler

* fix unused import

* fix fake stream in cloudflare

* fix cloudflare transformation

* fix naming for BaseModelResponseIterator

* add async cloudflare streaming test

* test cloudflare

* add handler.py

* add handler.py in cohere handler.py
This commit is contained in:
Ishaan Jaff 2024-12-10 10:12:22 -08:00 committed by GitHub
parent 1ef311343c
commit bd39e1ab5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 391 additions and 268 deletions

View file

@ -13,7 +13,6 @@ from typing import (
)
import httpx # type: ignore
import requests # type: ignore
from openai.types.chat.chat_completion_chunk import Choice as OpenAIStreamingChoice
import litellm
@ -109,6 +108,11 @@ class BaseLLMHTTPHandler:
optional_params=optional_params,
)
api_base = provider_config.get_complete_url(
api_base=api_base,
model=model,
)
data = provider_config.transform_request(
model=model,
messages=messages,