[Feature] Add support for Together AI API (#1058)

This commit is contained in:
Sukkrit Sharma
2023-12-25 18:36:20 +05:30
committed by GitHub
parent 6be29f5bed
commit 6c1ea7799e
15 changed files with 629 additions and 128 deletions

View File

@@ -10,5 +10,5 @@ from embedchain import Pipeline as App
app = App()
app.add("https://docs.embedchain.ai/", data_type="docs_site")
app.query("What is Embedchain?")
# Answer: Embedchain is a platform that utilizes various components, including paid/proprietary ones, to provide what is believed to be the best configuration available. It uses LLM (Language Model) providers such as OpenAI, Anthpropic, Vertex_AI, GPT4ALL, Azure_OpenAI, LLAMA2, JINA, Ollama and COHERE. Embedchain allows users to import and utilize these LLM providers for their applications.'
# Answer: Embedchain is a platform that utilizes various components, including paid/proprietary ones, to provide what is believed to be the best configuration available. It uses LLM (Language Model) providers such as OpenAI, Anthpropic, Vertex_AI, GPT4ALL, Azure_OpenAI, LLAMA2, JINA, Ollama, Together and COHERE. Embedchain allows users to import and utilize these LLM providers for their applications.'
```

View File

@@ -12,7 +12,8 @@ Embedchain comes with built-in support for various popular large language models
<Card title="Azure OpenAI" href="#azure-openai"></Card>
<Card title="Anthropic" href="#anthropic"></Card>
<Card title="Cohere" href="#cohere"></Card>
<Card title="Ollama" href="#Ollama"></Card>
<Card title="Together" href="#together"></Card>
<Card title="Ollama" href="#ollama"></Card>
<Card title="GPT4All" href="#gpt4all"></Card>
<Card title="JinaChat" href="#jinachat"></Card>
<Card title="Hugging Face" href="#hugging-face"></Card>
@@ -330,6 +331,42 @@ llm:
</CodeGroup>
## Together
Install related dependencies using the following command:
```bash
pip install --upgrade 'embedchain[together]'
```
Set the `TOGETHER_API_KEY` as environment variable which you can find on their [Account settings page](https://api.together.xyz/settings/api-keys).
Once you have the API key, you are all set to use it with Embedchain.
<CodeGroup>
```python main.py
import os
from embedchain import Pipeline as App
os.environ["TOGETHER_API_KEY"] = "xxx"
# load llm configuration from config.yaml file
app = App.from_config(config_path="config.yaml")
```
```yaml config.yaml
llm:
provider: together
config:
model: togethercomputer/RedPajama-INCITE-7B-Base
temperature: 0.5
max_tokens: 1000
top_p: 1
```
</CodeGroup>
## Ollama
Setup Ollama using https://github.com/jmorganca/ollama

View File

@@ -44,6 +44,10 @@ Get started with Embedchain by trying out the examples below. You can run the ex
<td className="align-middle"><a target="_blank" href="https://colab.research.google.com/github/embedchain/embedchain/blob/main/notebooks/cohere.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" noZoom alt="Open In Colab"/></a></td>
<td className="align-middle"><a target="_blank" href="https://replit.com/@taranjeetio/cohere#main.py"><img src="https://replit.com/badge?caption=Try%20with%20Replit&amp;variant=small" noZoom alt="Try with Replit Badge"/></a></td>
</tr>
<tr>
<td className="align-middle">Together</td>
<td className="align-middle"><a target="_blank" href="https://colab.research.google.com/github/embedchain/embedchain/blob/main/notebooks/together.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" noZoom alt="Open In Colab"/></a></td>
</tr>
<tr>
<td className="align-middle">Ollama</td>
<td className="align-middle"><a target="_blank" href="https://colab.research.google.com/github/embedchain/embedchain/blob/main/notebooks/ollama.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" noZoom alt="Open In Colab"/></a></td>

View File

@@ -81,6 +81,7 @@ curl --request POST \
| `OPENAI_API_BASE` | Azure OpenAI |
| `OPENAI_API_VERSION` | Azure OpenAI |
| `COHERE_API_KEY` | Cohere |
| `TOGETHER_API_KEY` | Together |
| `ANTHROPIC_API_KEY` | Anthropic |
| `JINACHAT_API_KEY` | Jina |
| `HUGGINGFACE_ACCESS_TOKEN` | Huggingface |