|
|
@ -1,45 +1,52 @@
|
|
|
|
# DeepInfra
|
|
|
|
# DeepInfra
|
|
|
|
|
|
|
|
|
|
|
|
This page covers how to use the DeepInfra ecosystem within LangChain.
|
|
|
|
>[DeepInfra](https://deepinfra.com/docs) allows us to run the
|
|
|
|
|
|
|
|
> [latest machine learning models](https://deepinfra.com/models) with ease.
|
|
|
|
|
|
|
|
> DeepInfra takes care of all the heavy lifting related to running, scaling and monitoring
|
|
|
|
|
|
|
|
> the models. Users can focus on your application and integrate the models with simple REST API calls.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>DeepInfra provides [examples](https://deepinfra.com/docs/advanced/langchain) of integration with LangChain.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This page covers how to use the `DeepInfra` ecosystem within `LangChain`.
|
|
|
|
It is broken into two parts: installation and setup, and then references to specific DeepInfra wrappers.
|
|
|
|
It is broken into two parts: installation and setup, and then references to specific DeepInfra wrappers.
|
|
|
|
|
|
|
|
|
|
|
|
## Installation and Setup
|
|
|
|
## Installation and Setup
|
|
|
|
|
|
|
|
|
|
|
|
- Get your DeepInfra api key from this link [here](https://deepinfra.com/).
|
|
|
|
- Get your DeepInfra api key from this link [here](https://deepinfra.com/).
|
|
|
|
- Get an DeepInfra api key and set it as an environment variable (`DEEPINFRA_API_TOKEN`)
|
|
|
|
- Get an DeepInfra api key and set it as an environment variable (`DEEPINFRA_API_TOKEN`)
|
|
|
|
|
|
|
|
|
|
|
|
## Available Models
|
|
|
|
## Available Models
|
|
|
|
|
|
|
|
|
|
|
|
DeepInfra provides a range of Open Source LLMs ready for deployment.
|
|
|
|
DeepInfra provides a range of Open Source LLMs ready for deployment.
|
|
|
|
You can list supported models for
|
|
|
|
|
|
|
|
|
|
|
|
You can see supported models for
|
|
|
|
[text-generation](https://deepinfra.com/models?type=text-generation) and
|
|
|
|
[text-generation](https://deepinfra.com/models?type=text-generation) and
|
|
|
|
[embeddings](https://deepinfra.com/models?type=embeddings).
|
|
|
|
[embeddings](https://deepinfra.com/models?type=embeddings).
|
|
|
|
google/flan\* models can be viewed [here](https://deepinfra.com/models?type=text2text-generation).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can view a [list of request and response parameters](https://deepinfra.com/meta-llama/Llama-2-70b-chat-hf/api).
|
|
|
|
You can view a [list of request and response parameters](https://deepinfra.com/meta-llama/Llama-2-70b-chat-hf/api).
|
|
|
|
|
|
|
|
|
|
|
|
Chat models [follow openai api](https://deepinfra.com/meta-llama/Llama-2-70b-chat-hf/api?example=openai-http)
|
|
|
|
Chat models [follow openai api](https://deepinfra.com/meta-llama/Llama-2-70b-chat-hf/api?example=openai-http)
|
|
|
|
|
|
|
|
|
|
|
|
## Wrappers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### LLM
|
|
|
|
## LLM
|
|
|
|
|
|
|
|
|
|
|
|
There exists an DeepInfra LLM wrapper, which you can access with
|
|
|
|
See a [usage example](/docs/integrations/llms/deepinfra).
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
```python
|
|
|
|
from langchain_community.llms import DeepInfra
|
|
|
|
from langchain_community.llms import DeepInfra
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Embeddings
|
|
|
|
## Embeddings
|
|
|
|
|
|
|
|
|
|
|
|
There is also an DeepInfra Embeddings wrapper, you can access with
|
|
|
|
See a [usage example](/docs/integrations/text_embedding/deepinfra).
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
```python
|
|
|
|
from langchain_community.embeddings import DeepInfraEmbeddings
|
|
|
|
from langchain_community.embeddings import DeepInfraEmbeddings
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Chat Models
|
|
|
|
## Chat Models
|
|
|
|
|
|
|
|
|
|
|
|
There is a chat-oriented wrapper as well, accessible with
|
|
|
|
See a [usage example](/docs/integrations/chat/deepinfra).
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
```python
|
|
|
|
from langchain_community.chat_models import ChatDeepInfra
|
|
|
|
from langchain_community.chat_models import ChatDeepInfra
|
|
|
|