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 | [Pinecone](https://www.pinecone.io/) is a fully managed vector database designed for machine learning applications, offering high performance vector search with low latency at scale. It's particularly well-suited for semantic search, recommendation systems, and other AI-powered applications. |
| #2 | |
| #3 | > **New**: Pinecone integration now supports custom namespaces! Use the `namespace` parameter to logically separate data within the same index. This is especially useful for multi-tenant or multi-user applications. |
| #4 | |
| #5 | > **Note**: Before configuring Pinecone, you need to select an embedding model (e.g., OpenAI, Cohere, or custom models) and ensure the `embedding_model_dims` in your config matches your chosen model's dimensions. For example, OpenAI's text-embedding-3-small uses 1536 dimensions. |
| #6 | |
| #7 | ### Usage |
| #8 | |
| #9 | ```python |
| #10 | import os |
| #11 | from mem0 import Memory |
| #12 | |
| #13 | os.environ["OPENAI_API_KEY"] = "sk-xx" |
| #14 | os.environ["PINECONE_API_KEY"] = "your-api-key" |
| #15 | |
| #16 | # Example using serverless configuration |
| #17 | config = { |
| #18 | "vector_store": { |
| #19 | "provider": "pinecone", |
| #20 | "config": { |
| #21 | "collection_name": "testing", |
| #22 | "embedding_model_dims": 1536, # Matches OpenAI's text-embedding-3-small |
| #23 | "namespace": "my-namespace", # Optional: specify a namespace for multi-tenancy |
| #24 | "serverless_config": { |
| #25 | "cloud": "aws", # Choose between 'aws' or 'gcp' or 'azure' |
| #26 | "region": "us-east-1" |
| #27 | }, |
| #28 | "metric": "cosine" |
| #29 | } |
| #30 | } |
| #31 | } |
| #32 | |
| #33 | m = Memory.from_config(config) |
| #34 | messages = [ |
| #35 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #36 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #37 | {"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."}, |
| #38 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #39 | ] |
| #40 | m.add(messages, user_id="alice", metadata={"category": "movies"}) |
| #41 | ``` |
| #42 | |
| #43 | ### Config |
| #44 | |
| #45 | Here are the parameters available for configuring Pinecone: |
| #46 | |
| #47 | | Parameter | Description | Default Value | |
| #48 | | --- | --- | --- | |
| #49 | | `collection_name` | Name of the index/collection | Required | |
| #50 | | `embedding_model_dims` | Dimensions of the embedding model (must match your chosen embedding model) | Required | |
| #51 | | `client` | Existing Pinecone client instance | `None` | |
| #52 | | `api_key` | API key for Pinecone | Environment variable: `PINECONE_API_KEY` | |
| #53 | | `environment` | Pinecone environment | `None` | |
| #54 | | `serverless_config` | Configuration for serverless deployment (AWS or GCP or Azure) | `None` | |
| #55 | | `pod_config` | Configuration for pod-based deployment | `None` | |
| #56 | | `hybrid_search` | Whether to enable hybrid search | `False` | |
| #57 | | `metric` | Distance metric for vector similarity | `"cosine"` | |
| #58 | | `batch_size` | Batch size for operations | `100` | |
| #59 | | `namespace` | Namespace for the collection, useful for multi-tenancy. | `None` | |
| #60 | |
| #61 | > **Important**: You must choose either `serverless_config` or `pod_config` for your deployment, but not both. |
| #62 | |
| #63 | #### Serverless Config Example |
| #64 | ```python |
| #65 | config = { |
| #66 | "vector_store": { |
| #67 | "provider": "pinecone", |
| #68 | "config": { |
| #69 | "collection_name": "memory_index", |
| #70 | "embedding_model_dims": 1536, # For OpenAI's text-embedding-3-small |
| #71 | "namespace": "my-namespace", # Optional: custom namespace |
| #72 | "serverless_config": { |
| #73 | "cloud": "aws", # or "gcp" or "azure" |
| #74 | "region": "us-east-1" # Choose appropriate region |
| #75 | } |
| #76 | } |
| #77 | } |
| #78 | } |
| #79 | ``` |
| #80 | |
| #81 | #### Pod Config Example |
| #82 | ```python |
| #83 | config = { |
| #84 | "vector_store": { |
| #85 | "provider": "pinecone", |
| #86 | "config": { |
| #87 | "collection_name": "memory_index", |
| #88 | "embedding_model_dims": 1536, # For OpenAI's text-embedding-ada-002 |
| #89 | "namespace": "my-namespace", # Optional: custom namespace |
| #90 | "pod_config": { |
| #91 | "environment": "gcp-starter", |
| #92 | "replicas": 1, |
| #93 | "pod_type": "starter" |
| #94 | } |
| #95 | } |
| #96 | } |
| #97 | } |
| #98 | ``` |