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: DeepSeek |
| #3 | --- |
| #4 | |
| #5 | To use DeepSeek LLM models, you have to set the `DEEPSEEK_API_KEY` environment variable. You can also optionally set `DEEPSEEK_API_BASE` if you need to use a different API endpoint (defaults to "https://api.deepseek.com"). |
| #6 | |
| #7 | ## Usage |
| #8 | |
| #9 | ```python |
| #10 | import os |
| #11 | from mem0 import Memory |
| #12 | |
| #13 | os.environ["DEEPSEEK_API_KEY"] = "your-api-key" |
| #14 | os.environ["OPENAI_API_KEY"] = "your-api-key" # for embedder model |
| #15 | |
| #16 | config = { |
| #17 | "llm": { |
| #18 | "provider": "deepseek", |
| #19 | "config": { |
| #20 | "model": "deepseek-chat", # default model |
| #21 | "temperature": 0.2, |
| #22 | "max_tokens": 2000, |
| #23 | "top_p": 1.0 |
| #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 | You can also configure the API base URL in the config: |
| #39 | |
| #40 | ```python |
| #41 | config = { |
| #42 | "llm": { |
| #43 | "provider": "deepseek", |
| #44 | "config": { |
| #45 | "model": "deepseek-chat", |
| #46 | "deepseek_base_url": "https://your-custom-endpoint.com", |
| #47 | "api_key": "your-api-key" # alternatively to using environment variable |
| #48 | } |
| #49 | } |
| #50 | } |
| #51 | ``` |
| #52 | |
| #53 | ## Config |
| #54 | |
| #55 | All available parameters for the `deepseek` config are present in [Master List of All Params in Config](../config). |