-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation errors #56
Comments
Hi, this errors occur when you try to use Node.js modules like You can e.g. use dunamic imports in your code like: if (typeof window === 'undefined') {
const { util } = await import('@ax-llm/ax');
} |
Thanks for the quick reply. I see, I'll use it a cloud function instead. |
It makes sense to keep it server-only as there are your API keys for OpenAI or Anthropic LLM models, and you don't want to share them with every internet user :) You might not like the bill for API usage after that :) |
Sure, though there are a variety of methods for keeping keys reasonably secure client side. Just a suggestion, but might be good to highlight the fact in the docs it's for server side use, just to make things clear up front. |
I'm submitting a ...
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[X ] question about how to use this project
Summary
Looks like a great project so I decided to test it out with a https://quasar.dev/ js project.
This is compatible with ts package imports, so I imported as per the guide.
So, the issue is I imported https://github.com/ax-llm/ax aok as per npm install @ax-llm/ax did a quasar build and my project is aok. Runs fine.
It's when I go to use AX strange things begine to happen.
If I add the following line to a file import { AxAgent, AxAI, AxFunction, AxSignature } from '@ax-llm/ax'; in preparation for using it I immediately get compilation error #1:
Compilation error 1: [Resolved]
Syntax Error: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
I fixed this by modifying the quaser.config chain webpack:
chainWebpack(chain) {
chain
.plugin("eslint-webpack-plugin")
.use(ESLintPlugin, [{ extensions: ["js", "vue"] }]),
chain.merge({
externals: {
"node:fs": "commonjs util",
},
});
},
},
So that passed, but then I got another bunch of compilation errors, which I copy just below.
I tried importing one out of interest [npm install --save stream/web] but that failed with fatal: Could not read from remote repository.
Any clues as to what is going on here? Would love to test it out in an integration project.
I ran the examples locally ok, just trying to integrate it into a basic Quasar js project doesn't seem to work too well.
Thanks!
Compilation errors #2 [Unresolved]
App • ERROR • UI in ./node_modules/@ax-llm/ax/ai/util.js
Module not found: Can't resolve imported dependency "crypto"
Did you forget to install it? You can run: npm install --save crypto
App • ERROR • UI in ./node_modules/@ax-llm/ax/dsp/generate.js
Module not found: Can't resolve imported dependency "stream/web"
Did you forget to install it? You can run: npm install --save stream/web
App • ERROR • UI in ./node_modules/@ax-llm/ax/dsp/sig.js
Module not found: Can't resolve imported dependency "crypto"
Did you forget to install it? You can run: npm install --save crypto
App • ERROR • UI in ./node_modules/@ax-llm/ax/funcs/code.js
Module not found: Can't resolve imported dependency "crypto"
Did you forget to install it? You can run: npm install --save crypto
App • ERROR • UI in ./node_modules/@ax-llm/ax/funcs/code.js
Module not found: Can't resolve imported dependency "http"
Did you forget to install it? You can run: npm install --save http
App • ERROR • UI in ./node_modules/@ax-llm/ax/funcs/code.js
Module not found: Can't resolve imported dependency "https"
Did you forget to install it? You can run: npm install --save https
App • ERROR • UI in ./node_modules/@ax-llm/ax/funcs/code.js
Module not found: Can't resolve imported dependency "os"
Did you forget to install it? You can run: npm install --save os
App • ERROR • UI in ./node_modules/@ax-llm/ax/funcs/code.js
Module not found: Can't resolve imported dependency "process"
Did you forget to install it? You can run: npm install --save process
App • ERROR • UI in ./node_modules/@ax-llm/ax/funcs/code.js
Module not found: Can't resolve imported dependency "vm"
Did you forget to install it? You can run: npm install --save vm
App • ERROR • UI in ./node_modules/@ax-llm/ax/util/apicall.js
Module not found: Can't resolve imported dependency "path"
Did you forget to install it? You can run: npm install --save path
App • ERROR • UI in ./node_modules/@ax-llm/ax/util/apicall.js
Module not found: Can't resolve imported dependency "stream/web"
Did you forget to install it? You can run: npm install --save stream/web
App • COMPILATION FAILED • Please check the log above for details.
The text was updated successfully, but these errors were encountered: