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 | import os |
| #2 | from typing import Any, Dict, Optional |
| #3 | |
| #4 | from pydantic import BaseModel, Field |
| #5 | |
| #6 | from mem0.embeddings.configs import EmbedderConfig |
| #7 | from mem0.graphs.configs import GraphStoreConfig |
| #8 | from mem0.llms.configs import LlmConfig |
| #9 | from mem0.vector_stores.configs import VectorStoreConfig |
| #10 | from mem0.configs.rerankers.config import RerankerConfig |
| #11 | |
| #12 | # Set up the directory path |
| #13 | home_dir = os.path.expanduser("~") |
| #14 | mem0_dir = os.environ.get("MEM0_DIR") or os.path.join(home_dir, ".mem0") |
| #15 | |
| #16 | |
| #17 | class MemoryItem(BaseModel): |
| #18 | id: str = Field(..., description="The unique identifier for the text data") |
| #19 | memory: str = Field( |
| #20 | ..., description="The memory deduced from the text data" |
| #21 | ) # TODO After prompt changes from platform, update this |
| #22 | hash: Optional[str] = Field(None, description="The hash of the memory") |
| #23 | # The metadata value can be anything and not just string. Fix it |
| #24 | metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata for the text data") |
| #25 | score: Optional[float] = Field(None, description="The score associated with the text data") |
| #26 | created_at: Optional[str] = Field(None, description="The timestamp when the memory was created") |
| #27 | updated_at: Optional[str] = Field(None, description="The timestamp when the memory was updated") |
| #28 | |
| #29 | |
| #30 | class MemoryConfig(BaseModel): |
| #31 | vector_store: VectorStoreConfig = Field( |
| #32 | description="Configuration for the vector store", |
| #33 | default_factory=VectorStoreConfig, |
| #34 | ) |
| #35 | llm: LlmConfig = Field( |
| #36 | description="Configuration for the language model", |
| #37 | default_factory=LlmConfig, |
| #38 | ) |
| #39 | embedder: EmbedderConfig = Field( |
| #40 | description="Configuration for the embedding model", |
| #41 | default_factory=EmbedderConfig, |
| #42 | ) |
| #43 | history_db_path: str = Field( |
| #44 | description="Path to the history database", |
| #45 | default=os.path.join(mem0_dir, "history.db"), |
| #46 | ) |
| #47 | graph_store: GraphStoreConfig = Field( |
| #48 | description="Configuration for the graph", |
| #49 | default_factory=GraphStoreConfig, |
| #50 | ) |
| #51 | reranker: Optional[RerankerConfig] = Field( |
| #52 | description="Configuration for the reranker", |
| #53 | default=None, |
| #54 | ) |
| #55 | version: str = Field( |
| #56 | description="The version of the API", |
| #57 | default="v1.1", |
| #58 | ) |
| #59 | custom_fact_extraction_prompt: Optional[str] = Field( |
| #60 | description="Custom prompt for the fact extraction", |
| #61 | default=None, |
| #62 | ) |
| #63 | custom_update_memory_prompt: Optional[str] = Field( |
| #64 | description="Custom prompt for the update memory", |
| #65 | default=None, |
| #66 | ) |
| #67 | |
| #68 | |
| #69 | class AzureConfig(BaseModel): |
| #70 | """ |
| #71 | Configuration settings for Azure. |
| #72 | |
| #73 | Args: |
| #74 | api_key (str): The API key used for authenticating with the Azure service. |
| #75 | azure_deployment (str): The name of the Azure deployment. |
| #76 | azure_endpoint (str): The endpoint URL for the Azure service. |
| #77 | api_version (str): The version of the Azure API being used. |
| #78 | default_headers (Dict[str, str]): Headers to include in requests to the Azure API. |
| #79 | """ |
| #80 | |
| #81 | api_key: str = Field( |
| #82 | description="The API key used for authenticating with the Azure service.", |
| #83 | default=None, |
| #84 | ) |
| #85 | azure_deployment: str = Field(description="The name of the Azure deployment.", default=None) |
| #86 | azure_endpoint: str = Field(description="The endpoint URL for the Azure service.", default=None) |
| #87 | api_version: str = Field(description="The version of the Azure API being used.", default=None) |
| #88 | default_headers: Optional[Dict[str, str]] = Field( |
| #89 | description="Headers to include in requests to the Azure API.", default=None |
| #90 | ) |
| #91 |