See the litellm
documention.
embedding
embedding(
*args,
cache_enabled: bool,
cache_path: typing.Union[str, pathlib.Path, NoneType],
cache_key_prefix: typing.Optional[str],
include_model_in_cache_key: bool,
return_cache_key: bool,
enable_retries: bool,
retry_on_exceptions: typing.Optional[list[Exception]],
retry_on_all_exceptions: bool,
max_retries: typing.Optional[int],
retry_delay: typing.Optional[int],
**kwargs
)
This function is a wrapper around a corresponding function in the litellm
library, see this for a full list of the available arguments.
response = embedding(
model="text-embedding-3-small",
input=[
"First string to embsed",
"Second string to embed",
],
)
response.data[1]['embedding'][:10]
[-0.0012842135038226843,
-0.013222426176071167,
-0.008362501859664917,
-0.04306064546108246,
-0.004547890741378069,
0.003748304443433881,
0.03082892671227455,
-0.012777778320014477,
-0.01638176664710045,
-0.01972052827477455]
async_embedding (async)
async_embedding(
*args,
cache_enabled: bool,
cache_path: typing.Union[str, pathlib.Path, NoneType],
cache_key_prefix: typing.Optional[str],
include_model_in_cache_key: bool,
return_cache_key: bool,
enable_retries: bool,
retry_on_exceptions: typing.Optional[list[Exception]],
retry_on_all_exceptions: bool,
max_retries: typing.Optional[int],
retry_delay: typing.Optional[int],
timeout: typing.Optional[int],
**kwargs
)
response = await async_embedding(
model="text-embedding-3-small",
input=[
"First string to embsed",
"Second string to embed",
],
)
response.data[1]['embedding'][:10]
[-0.0012842135038226843,
-0.013222426176071167,
-0.008362501859664917,
-0.04306064546108246,
-0.004547890741378069,
0.003748304443433881,
0.03082892671227455,
-0.012777778320014477,
-0.01638176664710045,
-0.01972052827477455]