-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
170be60
commit b11d633
Showing
4 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,42 @@ | ||
## Together | ||
|
||
1. Install libraries | ||
> Note: Fork and clone this repository if needed | ||
1. Create a virtual environment | ||
|
||
```shell | ||
pip install -U together | ||
python3 -m venv ~/.venvs/aienv | ||
source ~/.venvs/aienv/bin/activate | ||
``` | ||
|
||
2. Test Together Assistant | ||
2. Install libraries | ||
|
||
```shell | ||
pip install -U together phidata | ||
``` | ||
|
||
3. Test Together Assistant | ||
|
||
- Streaming | ||
|
||
```shell | ||
python cookbook/together/assistant.py | ||
``` | ||
|
||
3. Test Structured output | ||
- Without Streaming | ||
|
||
```shell | ||
python cookbook/together/assistant_stream_off.py | ||
``` | ||
|
||
4. Test Structured output | ||
|
||
```shell | ||
python cookbook/together/pydantic_output.py | ||
``` | ||
|
||
5. Test function calling | ||
|
||
```shell | ||
python cookbook/together/tool_call.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
from os import getenv | ||
from typing import Optional | ||
|
||
from phi.llm.openai.chat import OpenAIChat | ||
from phi.llm.openai.like import OpenAILike | ||
|
||
|
||
class Together(OpenAIChat): | ||
class Together(OpenAILike): | ||
name: str = "Together" | ||
model: str = "mistralai/Mixtral-8x7B-Instruct-v0.1" | ||
api_key: Optional[str] = getenv("TOGETHER_API_KEY") | ||
base_url: str = "https://api.together.xyz/v1" | ||
phi_proxy: bool = False |