To create a FirstBatch class, you need to provide an API key, along with optional configuration. The configuration fields are as follows for all SDKs:
Embedding Size: A global embeddings size for FirstBatch class. Operations will use global embedding size if its not explicitly stated.
Batch Size: Number of results returned from FirstBatch SDK.
Quantizer Train Size: Training data size for quantizer. Note that Add a VectorDB relies on the train size and it will take longer to finish with increase train sizes.
Quantizer Type: Quantizer type used to model distribution. Only accepts "scalar" currently, with "product" option soon to come.
Enable History: If true, will keep track of items shown to user and will not re-display the same items within the same session.
Verbose: Enables internal logs.
Note that all of these fields are optional and have their defaults.
Add a vectorDB of your choice to the instantiated FirstBatch client.
When you add a vector database, the sketching process can take up to 80 seconds the first time it runs. This operation is unique to each API_KEY and vdbid combination.
Changing either the API_KEY or vdbid results in the system treating it as a new vector database instance.
:param vdbid: VectorDB ID of your choice,str:param vs: VectorStore,object:param embedding_size: Embedding size of your collection,ifnot will use class level embedding size,int
Adds VectorStore instance to Client.
Example run:
personalized.add_vdb("my_db", Pinecone(index))
addVdb
Parameters
vdbid: VectorDB id of your choice
vectorStore: a VectorStore instance
embeddingSize: optional embedding size
Example
personalized.addVdb("my_db",Pinecone(index))
Create a Session
Creates a new session with the provided parameters & vector database ID. This method returns the sessionID; however, you can provide the sessionID with this method to create a persistent session.
When an algorithm other than SIMPLE or CUSTOM is used, it is registered as a FACTORY algorithm with the factoryId as the name of the algorithm.
session
:param algorithm: Algorithm type of session, SIMPLE | CUSTOM | FACTORY types, AlgorithmLabel:param vdbid: VectorStore id,str:param session_id: Session id, Optional[str]:param custom_id: Custom Algorithm ID, obtained from the dashboard. Used only with CUSTOM algorithm, Optional[str]
Creates a session. Session id is returned. If session_id is provided, FirstBatch will create a persistent session.