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