IP Library Granted Patent US 12664141
Granted Patent B2
US 12664141 · App. 19/041,172 · Granted Jun 23, 2026

Locally-stored vector embedding databases

Inventors: Zhujun Lan (San Francisco, CA); Jonathan Gellin (Raleigh, NC); Walter Harley (Bellevue, WA); Bo Pang (San Francisco, CA)
Assignee: Salesforce, Inc.
G06F16/2237G06F16/212G06F16/23G06F16/245
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12664141
App. No.
19/041,172
Granted
Jun 23, 2026
Kind
B2
Abstract

Methods, apparatuses, and computer-program products are disclosed. The method may include storing, on a local machine, a first vector database and a second vector database that include first and second vector embeddings of first and second context information. The method may include receiving a query requesting generation of code. The method may include comparing a third vector embedding that is based on the query with the plurality of first vector embeddings and the plurality of second vector embeddings to identify one or more first vector embeddings and one or more second vector embeddings. The method may include generating a prompt that may include the query, first information and second information corresponding with the one or more first and second vector embeddings. The method may include generating, with a generative artificial intelligence (AI) model, a response to the query based on the query, the first information, and the second information.

Claims (48)

1 . A method for generating code using a generative artificial intelligence (AI) model, the method comprising:

storing a first vector database and a second vector database on a local machine associated with a client, the first vector database comprising a plurality of first vector embeddings corresponding with first context information, and the second vector database comprising a plurality of second vector embeddings corresponding with second context information;

updating, at the local machine, the first vector database, the second vector database, or any combination thereof, based at least in part on updates to local data performed at the local machine and further based at least in part on a rate of the updates to the local data satisfying an update rate threshold;

receiving a query from the client requesting generation of code;

comparing a third vector embedding generated based at least in part on the query with the plurality of first vector embeddings to identify one or more first vector embeddings of the plurality of first vector embeddings;

comparing the third vector embedding with the plurality of second vector embeddings to identify one or more second vector embeddings of the plurality of second vector embeddings;

generating a prompt comprising the query, first information corresponding to the one or more first vector embeddings, and second information corresponding with the one or more second vector embeddings; and

generating, with the generative AI model, a response to the query based at least in part on the query, the first information, and the second information.

2 . The method of claim 1 , wherein:

comparing the third vector embedding with the plurality of first vector embeddings is based at least in part on first vector similarity scores associated with the one or more first vector embeddings satisfying a first vector embedding score threshold; and

comparing the third vector embedding with the plurality of second vector embeddings is based at least in part on second vector similarity scores associated with the one or more second vector embeddings satisfying a second vector embedding score threshold.

3 . The method of claim 2 , wherein the first vector embedding score threshold is different than the second vector embedding score threshold.

4 . The method of claim 1 , wherein the first context information, the second context information, or both, comprise class definitions, database schema information, domain specific knowledge, code snippets, or any combination thereof.

5 . The method of claim 4 , wherein the database schema information comprises:

one or more custom object definitions that indicate one or more fields, one or more custom functions, or both.

6 . The method of claim 4 , wherein the class definitions are compressed class definitions.

7 . The method of claim 1 , further comprising:

generating, based at least in part on an embedding model, the first vector database based at least in part on the first context information; and

generating, based at least in part on the embedding model, the second vector database based at least in part on the second context information.

8 . The method of claim 7 , wherein the third vector embedding is based at least in part on the embedding model.

9 . The method of claim 7 , wherein the embedding model is located at a server that is remote to the local machine.

10 . The method of claim 1 , wherein:

the first context information corresponds with a first processing context; and

the second context information corresponds with a second processing context that is different than the first processing context.

11 . An apparatus for generating code using a generative artificial intelligence (AI) model, comprising:

one or more memories storing processor-executable coded instructions; and

one or more processors coupled with the one or more memories and individually or collectively operable to execute the coded instructions to cause the apparatus to:

store a first vector database and a second vector database on a local machine associated with a client, the first vector database comprising a plurality of first vector embeddings corresponding with first context information, and the second vector database comprising a plurality of second vector embeddings corresponding with second context information;

update, at the local machine, the first vector database, the second vector database, or any combination thereof, based at least in part on updates to local data performed at the local machine and further based at least in part on a rate of the updates to the local data satisfying an update rate threshold;

receive a query from the client requesting generation of code;

compare a third vector embedding generated based at least in part on the query with the plurality of first vector embeddings to identify one or more first vector embeddings of the plurality of first vector embeddings;

compare the third vector embedding with the plurality of second vector embeddings to identify one or more second vector embeddings of the plurality of second vector embeddings;

generate a prompt comprising the query, first information corresponding to the one or more first vector embeddings, and second information corresponding with the one or more second vector embeddings; and

generate, with the generative AI model, a response to the query based at least in part on the query, the first information, and the second information.

12 . The apparatus of claim 11 , wherein:

comparing the third vector embedding with the plurality of first vector embeddings is based at least in part on first vector similarity scores associated with the one or more first vector embeddings satisfying a first vector embedding score threshold; and

comparing the third vector embedding with the plurality of second vector embeddings is based at least in part on second vector similarity scores associated with the one or more second vector embeddings satisfying a second vector embedding score threshold.

13 . The apparatus of claim 12 , wherein the first vector embedding score threshold is different than the second vector embedding score threshold.

14 . The apparatus of claim 11 , wherein the first context information, the second context information, or both, comprise class definitions, database schema information, domain specific knowledge, code snippets, or any combination thereof.

15 . The apparatus of claim 14 , wherein the database schema information comprises one or more custom object definitions that indicate one or more fields, one or more custom functions, or both.

16 . A non-transitory computer-readable medium storing coded instructions for generating code using a generative artificial intelligence (AI) model, the coded instructions comprising instructions executable by one or more processors to:

store a first vector database and a second vector database on a local machine associated with a client, the first vector database comprising a plurality of first vector embeddings corresponding with first context information, and the second vector database comprising a plurality of second vector embeddings corresponding with second context information;

update, at the local machine, the first vector database, the second vector database, or any combination thereof, based at least in part on updates to local data performed at the local machine and further based at least in part on a rate of the updates to the local data satisfying an update rate threshold;

receive a query from the client requesting generation of code;

compare a third vector embedding generated based at least in part on the query with the plurality of first vector embeddings to identify one or more first vector embeddings of the plurality of first vector embeddings;

compare the third vector embedding with the plurality of second vector embeddings to identify one or more second vector embeddings of the plurality of second vector embeddings;

generate a prompt comprising the query, first information corresponding to the one or more first vector embeddings, and second information corresponding with the one or more second vector embeddings; and

generate, with the generative AI model, a response to the query based at least in part on the query, the first information, and the second information.