Skip to content

Commit 955a9dd

Browse files
authored
Merge pull request #1008 from constructive-io/devin/1776579383-graphile-llm-plugin
feat: add graphile-llm plugin — embedding, RAG, and text-to-vector for PostGraphile
2 parents b421fce + 3224ff7 commit 955a9dd

17 files changed

Lines changed: 5319 additions & 7446 deletions

graphile/graphile-llm/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# graphile-llm
2+
3+
LLM integration plugin for PostGraphile v5. Provides server-side text-to-vector embedding for pgvector columns.
4+
5+
## Features
6+
7+
- **Text-based vector search**: Adds `text: String` field to `VectorNearbyInput` — clients pass natural language instead of raw float vectors
8+
- **Text mutation fields**: Adds `{column}Text: String` companion fields on create/update inputs for vector columns
9+
- **Pluggable embedders**: Provider-based architecture (Ollama via `@agentic-kit/ollama`, with room for OpenAI, etc.)
10+
- **Per-database configuration**: Reads `llm_module` from `services_public.api_modules` for per-API embedder config
11+
- **Plugin-conditional**: Fields only appear in the schema when the plugin is loaded
12+
13+
## Usage
14+
15+
```typescript
16+
import { GraphileLlmPreset } from 'graphile-llm';
17+
18+
const preset = {
19+
extends: [
20+
GraphileLlmPreset({
21+
defaultEmbedder: {
22+
provider: 'ollama',
23+
model: 'nomic-embed-text',
24+
baseUrl: 'http://localhost:11434',
25+
},
26+
}),
27+
],
28+
};
29+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
testTimeout: 60000,
6+
transform: {
7+
'^.+\\.tsx?$': [
8+
'ts-jest',
9+
{
10+
babelConfig: false,
11+
tsconfig: 'tsconfig.json'
12+
}
13+
]
14+
},
15+
transformIgnorePatterns: [`/node_modules/*`],
16+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
17+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
18+
modulePathIgnorePatterns: ['dist/*']
19+
};

graphile/graphile-llm/package.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "graphile-llm",
3+
"version": "0.1.0",
4+
"description": "LLM integration plugin for PostGraphile v5 — server-side text-to-vector embedding and text companion fields for pgvector columns",
5+
"author": "Constructive <developers@constructive.io>",
6+
"homepage": "https://github.com/constructive-io/constructive",
7+
"license": "MIT",
8+
"main": "index.js",
9+
"module": "esm/index.js",
10+
"types": "index.d.ts",
11+
"scripts": {
12+
"clean": "makage clean",
13+
"prepack": "npm run build",
14+
"build": "makage build",
15+
"build:dev": "makage build --dev",
16+
"lint": "eslint . --fix",
17+
"test": "jest --forceExit",
18+
"test:watch": "jest --watch"
19+
},
20+
"publishConfig": {
21+
"access": "public",
22+
"directory": "dist"
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "https://github.com/constructive-io/constructive"
27+
},
28+
"bugs": {
29+
"url": "https://github.com/constructive-io/constructive/issues"
30+
},
31+
"dependencies": {
32+
"@agentic-kit/ollama": "^1.0.3"
33+
},
34+
"peerDependencies": {
35+
"@dataplan/pg": "1.0.0",
36+
"grafast": "1.0.0",
37+
"graphile-build": "5.0.0",
38+
"graphile-build-pg": "5.0.0",
39+
"graphile-config": "1.0.0",
40+
"graphile-search": "workspace:^",
41+
"graphile-utils": "5.0.0",
42+
"graphql": "16.13.0",
43+
"pg-sql2": "5.0.0",
44+
"postgraphile": "5.0.0"
45+
},
46+
"peerDependenciesMeta": {
47+
"graphile-search": {
48+
"optional": true
49+
},
50+
"graphile-utils": {
51+
"optional": true
52+
}
53+
},
54+
"devDependencies": {
55+
"@types/node": "^22.19.11",
56+
"graphile-connection-filter": "workspace:^",
57+
"graphile-search": "workspace:^",
58+
"graphile-test": "workspace:^",
59+
"makage": "^0.3.0",
60+
"pgsql-test": "workspace:^"
61+
},
62+
"keywords": [
63+
"postgraphile",
64+
"graphile",
65+
"constructive",
66+
"plugin",
67+
"llm",
68+
"embedding",
69+
"pgvector",
70+
"rag",
71+
"agentic-kit",
72+
"ollama",
73+
"openai"
74+
]
75+
}

0 commit comments

Comments
 (0)