repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: Together |
| #3 | --- |
| #4 | |
| #5 | To use Together LLM models, you have to set the `TOGETHER_API_KEY` environment variable. You can obtain the Together API key from their [Account settings page](https://api.together.xyz/settings/api-keys). |
| #6 | |
| #7 | ## Usage |
| #8 | |
| #9 | ```python |
| #10 | import os |
| #11 | from mem0 import Memory |
| #12 | |
| #13 | os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model |
| #14 | os.environ["TOGETHER_API_KEY"] = "your-api-key" |
| #15 | |
| #16 | config = { |
| #17 | "llm": { |
| #18 | "provider": "together", |
| #19 | "config": { |
| #20 | "model": "mistralai/Mixtral-8x7B-Instruct-v0.1", |
| #21 | "temperature": 0.2, |
| #22 | "max_tokens": 2000, |
| #23 | } |
| #24 | } |
| #25 | } |
| #26 | |
| #27 | m = Memory.from_config(config) |
| #28 | messages = [ |
| #29 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #30 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #31 | {"role": "user", "content": "I’m not a big fan of thriller movies but I love sci-fi movies."}, |
| #32 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #33 | ] |
| #34 | m.add(messages, user_id="alice", metadata={"category": "movies"}) |
| #35 | ``` |
| #36 | |
| #37 | ## Config |
| #38 | |
| #39 | All available parameters for the `together` config are present in [Master List of All Params in Config](../config). |