feat: add semantic fact search and embeddings
This commit is contained in:
@@ -16,7 +16,7 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
describe('initializeSchema', () => {
|
||||
it('creates the topics, facts, fact_topics, topic_relations, and topic_aliases tables', async () => {
|
||||
it('creates the topics, facts, fact_embeddings, fact_topics, topic_relations, and topic_aliases tables', async () => {
|
||||
const connection = await createDatabase({ client: 'sqlite', filename: ':memory:' });
|
||||
openConnections.push(connection.destroy);
|
||||
|
||||
@@ -33,6 +33,7 @@ describe('initializeSchema', () => {
|
||||
|
||||
expect(tableNames).toContain('topics');
|
||||
expect(tableNames).toContain('facts');
|
||||
expect(tableNames).toContain('fact_embeddings');
|
||||
expect(tableNames).toContain('fact_topics');
|
||||
expect(tableNames).toContain('topic_relations');
|
||||
expect(tableNames).toContain('topic_aliases');
|
||||
@@ -46,6 +47,7 @@ describe('initializeSchema', () => {
|
||||
|
||||
const topicsColumns = await sql<{ name: string }>`PRAGMA table_info(topics)`.execute(connection.db);
|
||||
const factsColumns = await sql<{ name: string }>`PRAGMA table_info(facts)`.execute(connection.db);
|
||||
const factEmbeddingsColumns = await sql<{ name: string }>`PRAGMA table_info(fact_embeddings)`.execute(connection.db);
|
||||
const factTopicsColumns = await sql<{ name: string }>`PRAGMA table_info(fact_topics)`.execute(connection.db);
|
||||
const topicRelationsColumns = await sql<{ name: string }>`PRAGMA table_info(topic_relations)`.execute(connection.db);
|
||||
const topicAliasesColumns = await sql<{ name: string }>`PRAGMA table_info(topic_aliases)`.execute(connection.db);
|
||||
@@ -73,6 +75,16 @@ describe('initializeSchema', () => {
|
||||
'updated_at',
|
||||
]);
|
||||
|
||||
expect(factEmbeddingsColumns.rows.map((row) => row.name)).toEqual([
|
||||
'fact_id',
|
||||
'model',
|
||||
'dimensions',
|
||||
'embedding',
|
||||
'content_hash',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
]);
|
||||
|
||||
expect(factTopicsColumns.rows.map((row) => row.name)).toEqual([
|
||||
'fact_id',
|
||||
'topic_id',
|
||||
|
||||
Reference in New Issue
Block a user