forked from phoenix/litellm-mirror
add docstring for /embeddings and /completions
This commit is contained in:
parent
f6e80b0031
commit
2be984ebee
1 changed files with 35 additions and 0 deletions
|
@ -3294,6 +3294,24 @@ async def completion(
|
||||||
model: Optional[str] = None,
|
model: Optional[str] = None,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
):
|
):
|
||||||
|
"""
|
||||||
|
Follows the exact same API spec as `OpenAI's Completions API https://platform.openai.com/docs/api-reference/completions`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X POST http://localhost:4000/v1/completions \
|
||||||
|
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
|
||||||
|
-H "Authorization: Bearer sk-1234" \
|
||||||
|
|
||||||
|
-d '{
|
||||||
|
"model": "gpt-3.5-turbo-instruct",
|
||||||
|
"prompt": "Once upon a time",
|
||||||
|
"max_tokens": 50,
|
||||||
|
"temperature": 0.7
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
"""
|
||||||
global user_temperature, user_request_timeout, user_max_tokens, user_api_base
|
global user_temperature, user_request_timeout, user_max_tokens, user_api_base
|
||||||
data = {}
|
data = {}
|
||||||
try:
|
try:
|
||||||
|
@ -3500,6 +3518,23 @@ async def embeddings(
|
||||||
model: Optional[str] = None,
|
model: Optional[str] = None,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
):
|
):
|
||||||
|
"""
|
||||||
|
Follows the exact same API spec as `OpenAI's Embeddings API https://platform.openai.com/docs/api-reference/embeddings`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X POST http://localhost:4000/v1/embeddings \
|
||||||
|
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
|
||||||
|
-H "Authorization: Bearer sk-1234" \
|
||||||
|
|
||||||
|
-d '{
|
||||||
|
"model": "text-embedding-ada-002",
|
||||||
|
"input": "The quick brown fox jumps over the lazy dog"
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
"""
|
||||||
global proxy_logging_obj
|
global proxy_logging_obj
|
||||||
data: Any = {}
|
data: Any = {}
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue