forked from phoenix/litellm-mirror
add support for friendli dedicated endpoint
This commit is contained in:
parent
f35af3bf1c
commit
dd10da4d46
3 changed files with 65 additions and 1 deletions
60
docs/my-website/docs/providers/friendliai.md
Normal file
60
docs/my-website/docs/providers/friendliai.md
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
# FriendliAI
|
||||||
|
https://suite.friendli.ai/
|
||||||
|
|
||||||
|
**We support ALL FriendliAI models, just set `friendliai/` as a prefix when sending completion requests**
|
||||||
|
|
||||||
|
## API Key
|
||||||
|
```python
|
||||||
|
# env variable
|
||||||
|
os.environ['FRIENDLI_TOKEN']
|
||||||
|
os.environ['FRIENDLI_API_BASE'] # Optional. Set this when using dedicated endpoint.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Usage
|
||||||
|
```python
|
||||||
|
from litellm import completion
|
||||||
|
import os
|
||||||
|
|
||||||
|
os.environ['FRIENDLI_TOKEN'] = ""
|
||||||
|
response = completion(
|
||||||
|
model="friendliai/mixtral-8x7b-instruct-v0-1",
|
||||||
|
messages=[
|
||||||
|
{"role": "user", "content": "hello from litellm"}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
print(response)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Usage - Streaming
|
||||||
|
```python
|
||||||
|
from litellm import completion
|
||||||
|
import os
|
||||||
|
|
||||||
|
os.environ['FRIENDLI_TOKEN'] = ""
|
||||||
|
response = completion(
|
||||||
|
model="friendliai/mixtral-8x7b-instruct-v0-1",
|
||||||
|
messages=[
|
||||||
|
{"role": "user", "content": "hello from litellm"}
|
||||||
|
],
|
||||||
|
stream=True
|
||||||
|
)
|
||||||
|
|
||||||
|
for chunk in response:
|
||||||
|
print(chunk)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Models
|
||||||
|
### Serverless Endpoints
|
||||||
|
We support ALL FriendliAI AI models, just set `friendliai/` as a prefix when sending completion requests
|
||||||
|
|
||||||
|
| Model Name | Function Call |
|
||||||
|
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| mixtral-8x7b-instruct | `completion(model="friendliai/mixtral-8x7b-instruct-v0-1", messages)` |
|
||||||
|
| meta-llama-3-8b-instruct | `completion(model="friendliai/meta-llama-3-8b-instruct", messages)` |
|
||||||
|
| meta-llama-3-70b-instruct | `completion(model="friendliai/meta-llama-3-70b-instruct", messages)` |
|
||||||
|
|
||||||
|
### Dedicated Endpoints
|
||||||
|
```
|
||||||
|
model="friendliai/$ENDPOINT_ID:$ADAPTER_ROUTE"
|
||||||
|
```
|
|
@ -158,6 +158,7 @@ const sidebars = {
|
||||||
"providers/triton-inference-server",
|
"providers/triton-inference-server",
|
||||||
"providers/ollama",
|
"providers/ollama",
|
||||||
"providers/perplexity",
|
"providers/perplexity",
|
||||||
|
"providers/friendliai",
|
||||||
"providers/groq",
|
"providers/groq",
|
||||||
"providers/deepseek",
|
"providers/deepseek",
|
||||||
"providers/fireworks_ai",
|
"providers/fireworks_ai",
|
||||||
|
|
|
@ -4486,7 +4486,10 @@ def get_llm_provider(
|
||||||
or get_secret("TOGETHER_AI_TOKEN")
|
or get_secret("TOGETHER_AI_TOKEN")
|
||||||
)
|
)
|
||||||
elif custom_llm_provider == "friendliai":
|
elif custom_llm_provider == "friendliai":
|
||||||
api_base = "https://inference.friendli.ai/v1"
|
api_base = (
|
||||||
|
get_secret("FRIENDLI_API_BASE")
|
||||||
|
or "https://inference.friendli.ai/v1"
|
||||||
|
)
|
||||||
dynamic_api_key = (
|
dynamic_api_key = (
|
||||||
api_key
|
api_key
|
||||||
or get_secret("FRIENDLIAI_API_KEY")
|
or get_secret("FRIENDLIAI_API_KEY")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue