#how would one store chunked embeddings with ts in postgres pgvector and access them in python

4 messages · Page 1 of 1 (latest)

old jacinth
#

i have postgres vector extension no clue how to structure my embeddings though

civic wedgeBOT
#

Hi @old jacinth. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I'm sorry, but the provided knowledge sources do not contain specific information on how to store chunked embeddings with TypeScript in a PostgreSQL database using the pgvector extension and then access them in Python.

However, I can guide you on how to work with embeddings in Python and TypeScript using the Nomic platform.

In Python, you can create an embeddings dataset and interact with it using the nomic library. Here's an example of how to create an embeddings dataset:

from nomic import atlas  
import numpy as np  
  
num_embeddings = 10000  
embeddings = np.random.rand(num_embeddings, 512)  
  
dataset = atlas.map_data(embeddings=embeddings)  
print(dataset)  

(Source: Nomic Documentation - Data upload (https://docs.nomic.ai/atlas/introduction/data-upload))

You can also access your dataset's embeddings with map.embeddings:

from nomic import AtlasDataset  
  
map = AtlasDataset('my-dataset').maps[0]  
  
# projected embeddings are your 2D embeddings  
projected_embeddings = map.embeddings.projected  
  
# latent embeddings are your high-dim vectors  
latent_embeddings = map.embeddings.latent  

(Source: Nomic Documentation - Accessing Dataset State (https://docs.nomic.ai/reference/python-api/access-map-data))

In TypeScript, you can use the official TypeScript bindings to interact with the Nomic Atlas platform:

import { embed } from '@nomic-ai/atlas';  
  
embed(['so much depends upon', 'a red wheel barrow'], `nk-123456789`).then(  
  (embeddings) => console.log({ embeddings })  
);  

(Source: Nomic Documentation - Typescript-api Overview (https://docs.nomic.ai/reference/typescript-api/overview))

#

For specific guidance on storing embeddings in a PostgreSQL database using the pgvector extension and accessing them in Python, I recommend referring to the official pgvector and PostgreSQL documentation or relevant resources.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: