Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions graphile/graphile-llm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# graphile-llm

LLM integration plugin for PostGraphile v5. Provides server-side text-to-vector embedding for pgvector columns.

## Features

- **Text-based vector search**: Adds `text: String` field to `VectorNearbyInput` — clients pass natural language instead of raw float vectors
- **Text mutation fields**: Adds `{column}Text: String` companion fields on create/update inputs for vector columns
- **Pluggable embedders**: Provider-based architecture (Ollama via `@agentic-kit/ollama`, with room for OpenAI, etc.)
- **Per-database configuration**: Reads `llm_module` from `services_public.api_modules` for per-API embedder config
- **Plugin-conditional**: Fields only appear in the schema when the plugin is loaded

## Usage

```typescript
import { GraphileLlmPreset } from 'graphile-llm';

const preset = {
extends: [
GraphileLlmPreset({
defaultEmbedder: {
provider: 'ollama',
model: 'nomic-embed-text',
baseUrl: 'http://localhost:11434',
},
}),
],
};
```
19 changes: 19 additions & 0 deletions graphile/graphile-llm/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testTimeout: 60000,
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
babelConfig: false,
tsconfig: 'tsconfig.json'
}
]
},
transformIgnorePatterns: [`/node_modules/*`],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePathIgnorePatterns: ['dist/*']
};
75 changes: 75 additions & 0 deletions graphile/graphile-llm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "graphile-llm",
"version": "0.1.0",
"description": "LLM integration plugin for PostGraphile v5 — server-side text-to-vector embedding and text companion fields for pgvector columns",
"author": "Constructive <developers@constructive.io>",
"homepage": "https://github.com/constructive-io/constructive",
"license": "MIT",
"main": "index.js",
"module": "esm/index.js",
"types": "index.d.ts",
"scripts": {
"clean": "makage clean",
"prepack": "npm run build",
"build": "makage build",
"build:dev": "makage build --dev",
"lint": "eslint . --fix",
"test": "jest --forceExit",
"test:watch": "jest --watch"
},
"publishConfig": {
"access": "public",
"directory": "dist"
},
"repository": {
"type": "git",
"url": "https://github.com/constructive-io/constructive"
},
"bugs": {
"url": "https://github.com/constructive-io/constructive/issues"
},
"dependencies": {
"@agentic-kit/ollama": "^1.0.3"
},
"peerDependencies": {
"@dataplan/pg": "1.0.0",
"grafast": "1.0.0",
"graphile-build": "5.0.0",
"graphile-build-pg": "5.0.0",
"graphile-config": "1.0.0",
"graphile-search": "workspace:^",
"graphile-utils": "5.0.0",
"graphql": "16.13.0",
"pg-sql2": "5.0.0",
"postgraphile": "5.0.0"
},
"peerDependenciesMeta": {
"graphile-search": {
"optional": true
},
"graphile-utils": {
"optional": true
}
},
"devDependencies": {
"@types/node": "^22.19.11",
"graphile-connection-filter": "workspace:^",
"graphile-search": "workspace:^",
"graphile-test": "workspace:^",
"makage": "^0.3.0",
"pgsql-test": "workspace:^"
},
"keywords": [
"postgraphile",
"graphile",
"constructive",
"plugin",
"llm",
"embedding",
"pgvector",
"rag",
"agentic-kit",
"ollama",
"openai"
]
}
Loading
Loading