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: Mistral AI |
| #3 | --- |
| #4 | |
| #5 | To use mistral's models, please obtain the Mistral AI api key from their [console](https://console.mistral.ai/). Set the `MISTRAL_API_KEY` environment variable to use the model as given below in the example. |
| #6 | |
| #7 | ## Usage |
| #8 | |
| #9 | <CodeGroup> |
| #10 | ```python Python |
| #11 | import os |
| #12 | from mem0 import Memory |
| #13 | |
| #14 | os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model |
| #15 | os.environ["MISTRAL_API_KEY"] = "your-api-key" |
| #16 | |
| #17 | config = { |
| #18 | "llm": { |
| #19 | "provider": "litellm", |
| #20 | "config": { |
| #21 | "model": "open-mixtral-8x7b", |
| #22 | "temperature": 0.1, |
| #23 | "max_tokens": 2000, |
| #24 | } |
| #25 | } |
| #26 | } |
| #27 | |
| #28 | m = Memory.from_config(config) |
| #29 | messages = [ |
| #30 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #31 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #32 | {"role": "user", "content": "I’m not a big fan of thriller movies but I love sci-fi movies."}, |
| #33 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #34 | ] |
| #35 | m.add(messages, user_id="alice", metadata={"category": "movies"}) |
| #36 | ``` |
| #37 | |
| #38 | ```typescript TypeScript |
| #39 | import { Memory } from 'mem0ai/oss'; |
| #40 | |
| #41 | const config = { |
| #42 | llm: { |
| #43 | provider: 'mistral', |
| #44 | config: { |
| #45 | apiKey: process.env.MISTRAL_API_KEY || '', |
| #46 | model: 'mistral-tiny-latest', // Or 'mistral-small-latest', 'mistral-medium-latest', etc. |
| #47 | temperature: 0.1, |
| #48 | maxTokens: 2000, |
| #49 | }, |
| #50 | }, |
| #51 | }; |
| #52 | |
| #53 | const memory = new Memory(config); |
| #54 | const messages = [ |
| #55 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #56 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #57 | {"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."}, |
| #58 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #59 | ] |
| #60 | await memory.add(messages, { userId: "alice", metadata: { category: "movies" } }); |
| #61 | ``` |
| #62 | </CodeGroup> |
| #63 | |
| #64 | ## Config |
| #65 | |
| #66 | All available parameters for the `litellm` config are present in [Master List of All Params in Config](../config). |