@ragpipe/plugin-cloudflare
Advanced tools
+7
-2
@@ -111,3 +111,7 @@ "use strict"; | ||
| } | ||
| return data.result.response; | ||
| if (data.result.choices?.length) { | ||
| const message = data.result.choices[0].message; | ||
| return message.content ?? message.reasoning_content ?? ""; | ||
| } | ||
| return data.result.response ?? ""; | ||
| }, | ||
@@ -146,3 +150,4 @@ async *generateStream(question, context, opts) { | ||
| const data = JSON.parse(payload); | ||
| if (data.response) yield data.response; | ||
| const chunk = data.choices?.[0]?.delta?.content ?? data.response; | ||
| if (chunk) yield chunk; | ||
| } catch { | ||
@@ -149,0 +154,0 @@ } |
+7
-2
@@ -84,3 +84,7 @@ // src/embedding.ts | ||
| } | ||
| return data.result.response; | ||
| if (data.result.choices?.length) { | ||
| const message = data.result.choices[0].message; | ||
| return message.content ?? message.reasoning_content ?? ""; | ||
| } | ||
| return data.result.response ?? ""; | ||
| }, | ||
@@ -119,3 +123,4 @@ async *generateStream(question, context, opts) { | ||
| const data = JSON.parse(payload); | ||
| if (data.response) yield data.response; | ||
| const chunk = data.choices?.[0]?.delta?.content ?? data.response; | ||
| if (chunk) yield chunk; | ||
| } catch { | ||
@@ -122,0 +127,0 @@ } |
+60
-63
| { | ||
| "name": "@ragpipe/plugin-cloudflare", | ||
| "version": "0.2.0", | ||
| "description": "Cloudflare Workers AI embedding and generation plugin for ragpipe", | ||
| "type": "module", | ||
| "license": "MIT", | ||
| "author": { | ||
| "name": "yungblud", | ||
| "url": "https://github.com/yungblud" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/yungblud/ragpipe", | ||
| "directory": "packages/plugin-cloudflare" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/yungblud/ragpipe/issues" | ||
| }, | ||
| "homepage": "https://github.com/yungblud/ragpipe#readme", | ||
| "publishConfig": { | ||
| "registry": "https://registry.npmjs.org/", | ||
| "access": "public" | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs" | ||
| } | ||
| }, | ||
| "main": "./dist/index.cjs", | ||
| "module": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "files": [ | ||
| "dist", | ||
| "README.md" | ||
| ], | ||
| "keywords": [ | ||
| "ragpipe", | ||
| "rag", | ||
| "cloudflare", | ||
| "workers-ai", | ||
| "embedding", | ||
| "generation", | ||
| "plugin" | ||
| ], | ||
| "peerDependencies": { | ||
| "ragpipe": ">=0.3.0" | ||
| }, | ||
| "devDependencies": { | ||
| "tsup": "^8.4.0", | ||
| "typescript": "^5.8.3", | ||
| "vitest": "^3.1.1", | ||
| "ragpipe": "0.3.0" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "dev": "tsup --watch", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "test:watch": "vitest", | ||
| "test:coverage": "vitest run --coverage" | ||
| } | ||
| } | ||
| "name": "@ragpipe/plugin-cloudflare", | ||
| "version": "0.3.0-alpha.1", | ||
| "description": "Cloudflare Workers AI embedding and generation plugin for ragpipe", | ||
| "type": "module", | ||
| "license": "MIT", | ||
| "author": { | ||
| "name": "yungblud", | ||
| "url": "https://github.com/yungblud" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/yungblud/ragpipe", | ||
| "directory": "packages/plugin-cloudflare" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/yungblud/ragpipe/issues" | ||
| }, | ||
| "homepage": "https://github.com/yungblud/ragpipe#readme", | ||
| "publishConfig": { | ||
| "registry": "https://registry.npmjs.org/", | ||
| "access": "public" | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs" | ||
| } | ||
| }, | ||
| "main": "./dist/index.cjs", | ||
| "module": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "files": ["dist", "README.md"], | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "dev": "tsup --watch", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "test:watch": "vitest", | ||
| "test:coverage": "vitest run --coverage" | ||
| }, | ||
| "keywords": [ | ||
| "ragpipe", | ||
| "rag", | ||
| "cloudflare", | ||
| "workers-ai", | ||
| "embedding", | ||
| "generation", | ||
| "plugin" | ||
| ], | ||
| "peerDependencies": { | ||
| "ragpipe": ">=0.3.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ragpipe": "workspace:*", | ||
| "tsup": "^8.4.0", | ||
| "typescript": "^5.8.3", | ||
| "vitest": "^3.1.1" | ||
| } | ||
| } |
14223
2.85%310
3.33%