mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
refactor(openai.py): moving embedding calls to http
This commit is contained in:
parent
c2cbdb23fd
commit
70311502c8
2 changed files with 75 additions and 21 deletions
|
@ -1725,28 +1725,17 @@ def embedding(
|
|||
api_type = "openai"
|
||||
api_version = None
|
||||
|
||||
## LOGGING
|
||||
logging.pre_call(
|
||||
input=input,
|
||||
api_key=api_key,
|
||||
additional_args={
|
||||
"api_type": api_type,
|
||||
"api_base": api_base,
|
||||
"api_version": api_version,
|
||||
},
|
||||
)
|
||||
## EMBEDDING CALL
|
||||
response = openai.Embedding.create(
|
||||
input=input,
|
||||
model=model,
|
||||
api_key=api_key,
|
||||
api_base=api_base,
|
||||
api_version=api_version,
|
||||
api_type=api_type,
|
||||
)
|
||||
|
||||
## LOGGING
|
||||
logging.post_call(input=input, api_key=api_key, original_response=response)
|
||||
## EMBEDDING CALL
|
||||
response = openai_chat_completions.embedding(
|
||||
model=model,
|
||||
input=input,
|
||||
api_base=api_base,
|
||||
api_key=api_key,
|
||||
logging_obj=logging,
|
||||
model_response=EmbeddingResponse(),
|
||||
optional_params=kwargs
|
||||
)
|
||||
elif model in litellm.cohere_embedding_models:
|
||||
cohere_key = (
|
||||
api_key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue