From afd7a98dc8276b0c51e58084d570debcec0e1e25 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Wed, 6 Nov 2024 09:20:49 +1300 Subject: [PATCH 1/3] Fix rag tool, add dockerignore --- .dockerignore | 1 + src/tools/ragTool.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..71fd1e9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +subquery-delegator \ No newline at end of file diff --git a/src/tools/ragTool.ts b/src/tools/ragTool.ts index 546d909..695f8e1 100644 --- a/src/tools/ragTool.ts +++ b/src/tools/ragTool.ts @@ -22,7 +22,7 @@ export class RagTool extends FunctionTool { type: "object", required: ["query"], properties: { - account: { + query: { type: "string", description: "A search string, generally the users prompt", }, From f90d437ed201a13bdc9ca628ed8e8bfcd9ce5a74 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Wed, 6 Nov 2024 10:17:26 +1300 Subject: [PATCH 2/3] Remove default argument from docker image, add more logging --- Dockerfile | 4 +--- src/app.ts | 7 ++++++- src/index.ts | 5 ++--- src/subcommands/info.ts | 3 +++ src/util.ts | 8 ++++++++ 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6dc184c..d1499c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,4 @@ WORKDIR /ai-app COPY . . RUN deno cache ./src/index.ts -ENTRYPOINT ["./src/index.ts"] - -CMD ["-p","/ai-app"] \ No newline at end of file +ENTRYPOINT ["./src/index.ts"] \ No newline at end of file diff --git a/src/app.ts b/src/app.ts index 2a9c5a3..a2aad97 100644 --- a/src/app.ts +++ b/src/app.ts @@ -12,7 +12,10 @@ import type { ISandbox } from "./sandbox/sandbox.ts"; import * as lancedb from "@lancedb/lancedb"; import type { IPFSClient } from "./ipfs.ts"; import { Loader } from "./loader.ts"; -import { fromFileUrlSafe, getPrompt } from "./util.ts"; +import { fromFileUrlSafe, getPrompt, getVersion } from "./util.ts"; +import { getLogger } from "./logger.ts"; + +const logger = await getLogger("app"); export async function runApp(config: { projectPath: string; @@ -25,6 +28,8 @@ export async function runApp(config: { streamKeepAlive: number; cacheDir?: string; }): Promise { + logger.info(`Subql AI Framework (${await getVersion()})`); + const model = new Ollama({ host: config.host }); const loader = new Loader( diff --git a/src/index.ts b/src/index.ts index da9265e..0efc00a 100755 --- a/src/index.ts +++ b/src/index.ts @@ -18,8 +18,7 @@ import yargs, { import { IPFSClient } from "./ipfs.ts"; import ora from "ora"; -import { getPrompt, setSpinner } from "./util.ts"; -import denoCfg from "../deno.json" with { type: "json" }; +import { getPrompt, getVersion, setSpinner } from "./util.ts"; import { initLogger } from "./logger.ts"; const DEFAULT_PORT = 7827; @@ -73,7 +72,7 @@ function ipfsFromArgs( yargs(Deno.args) .env("SUBQL_AI") .scriptName("subql-ai") - .version(denoCfg.version) + .version(await getVersion()) .command( "$0", "Run a SubQuery AI app", diff --git a/src/subcommands/info.ts b/src/subcommands/info.ts index d597f76..5899dba 100644 --- a/src/subcommands/info.ts +++ b/src/subcommands/info.ts @@ -3,6 +3,7 @@ import { getDefaultSandbox } from "../sandbox/index.ts"; import type { ProjectManifest } from "../project/project.ts"; import type { IPFSClient } from "../ipfs.ts"; import { Loader } from "../loader.ts"; +import { getVersion } from "../util.ts"; type StaticProject = ProjectManifest & { tools?: string[]; @@ -38,6 +39,8 @@ export async function projectInfo( const [_, manifest] = await loader.getManifest(); const staticProject = await getProjectJson(manifest, loader); + console.log(`Subql AI Framework (${await getVersion()})`); + if (json) { console.log(JSON.stringify( staticProject, diff --git a/src/util.ts b/src/util.ts index 081b8a2..8527881 100644 --- a/src/util.ts +++ b/src/util.ts @@ -96,3 +96,11 @@ export function timeout(ms: number): Promise { setTimeout(() => resolve(), ms); }); } + +export async function getVersion(): Promise { + const { default: denoCfg } = await import("../deno.json", { + with: { type: "json" }, + }); + + return denoCfg.version; +} From 4e985012abe2a4908388ac6ffa21d71a76af4b35 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Wed, 6 Nov 2024 10:33:58 +1300 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9f3ddc..f739a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- RagTool parameters naming missmatch (#25) + +### Changed +- Docker: Exclude submodule, remove default project argument (#25) ## [0.0.3] - 2024-11-05 ### Changed