Skip to content

Commit

Permalink
Add ability to use LLMs and embedding models from Ollama running loca…
Browse files Browse the repository at this point in the history
…lly. (#45)

* add new ollama provider, ability to use local ollama llama3.1 llm

* revert header override for local ollama.

* added in ollama nomic-embed-text embeddings

* remove toggle to use ollama and fallback to using llm names.

* add in ollama embeddings - mxbai-embed-large

* configure ollama url via settings, and throw expection if not set.

* adjust dimensions for mxbai_embed_large

* retain bearer header incase needed for hosted ollama

* updated with linting changes.

* remove incept5/llama3.1-claude and be explicit on llama3.1:8b

* removed usage of openAIKey for ollama

* update filenames to be more meaningful
  • Loading branch information
damonsk authored Oct 27, 2024
1 parent 454b55a commit 32c1c98
Show file tree
Hide file tree
Showing 20 changed files with 857 additions and 119 deletions.
10 changes: 10 additions & 0 deletions drizzle/0002_create_vector_data_nomic_embed_text.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS "vector_data_nomic_embed_text" (
"id" serial PRIMARY KEY NOT NULL,
"path" text NOT NULL,
"mtime" bigint NOT NULL,
"content" text NOT NULL,
"embedding" vector(768),
"metadata" jsonb NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "embeddingIndex_nomic_embed_text" ON "vector_data_nomic_embed_text" USING hnsw ("embedding" vector_cosine_ops);
10 changes: 10 additions & 0 deletions drizzle/0003_create_vector_data_mxbai_embed_large.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS "vector_data_mxbai_embed_large" (
"id" serial PRIMARY KEY NOT NULL,
"path" text NOT NULL,
"mtime" bigint NOT NULL,
"content" text NOT NULL,
"embedding" vector(1024),
"metadata" jsonb NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "embeddingIndex_mxbai_embed_large" ON "vector_data_mxbai_embed_large" USING hnsw ("embedding" vector_cosine_ops);
192 changes: 192 additions & 0 deletions drizzle/meta/0002_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"id": "66d66503-35b5-4c19-8433-529426a63956",
"prevId": "1084161a-8de5-4452-ba8b-6ffc3549d411",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.vector_data_text_embedding_3_small": {
"name": "vector_data_text_embedding_3_small",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"path": {
"name": "path",
"type": "text",
"primaryKey": false,
"notNull": true
},
"mtime": {
"name": "mtime",
"type": "bigint",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"embedding": {
"name": "embedding",
"type": "vector(1536)",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"embeddingIndex_text_embedding_3_small": {
"name": "embeddingIndex_text_embedding_3_small",
"columns": [
{
"expression": "embedding",
"isExpression": false,
"asc": true,
"nulls": "last",
"opclass": "vector_cosine_ops"
}
],
"isUnique": false,
"concurrently": false,
"method": "hnsw",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"public.vector_data_text_embedding_3_large": {
"name": "vector_data_text_embedding_3_large",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"path": {
"name": "path",
"type": "text",
"primaryKey": false,
"notNull": true
},
"mtime": {
"name": "mtime",
"type": "bigint",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"embedding": {
"name": "embedding",
"type": "vector(3072)",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"public.vector_data_nomic_embed_text": {
"name": "vector_data_nomic_embed_text",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"path": {
"name": "path",
"type": "text",
"primaryKey": false,
"notNull": true
},
"mtime": {
"name": "mtime",
"type": "bigint",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"embedding": {
"name": "embedding",
"type": "vector(768)",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"embeddingIndex_nomic_embed_text": {
"name": "embeddingIndex_nomic_embed_text",
"columns": [
{
"expression": "embedding",
"isExpression": false,
"asc": true,
"nulls": "last",
"opclass": "vector_cosine_ops"
}
],
"isUnique": false,
"concurrently": false,
"method": "hnsw",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"enums": {},
"schemas": {},
"sequences": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
Loading

0 comments on commit 32c1c98

Please sign in to comment.