ax-llm / ax

The unofficial DSPy framework. Build LLM powered Agents and "Agentic workflows" based on the Stanford DSP paper.
http://axllm.dev
Apache License 2.0
1.05k stars 70 forks source link

prototyping on observable #31

Open trebor opened 3 months ago

trebor commented 3 months ago

i would love to use ax-llm in observable but sadly the module won't import. :(

https://observablehq.com/@observablehq/module-require-debugger?module=@ax-llm/ax

i'm not really sure why. i tried to fork and build my own module, but i am not a module expert, and couldn't figure it out.

dosco commented 3 months ago

interesting will look into this do you know another package that does work will help me compare

dosco commented 3 months ago

i'm looking into abstracting out fs so the library can work in browsers.

trebor commented 3 months ago

thank you for the quick response!

as an example, i found a very small module that imports properly, see:

https://observablehq.com/@trebor/filled-array-example

i didn't realize ax was hitting the file system, so that suddenly sounds like more work than i had thought.

dosco commented 3 months ago

no worries happy to get it working in browsers

dosco commented 3 months ago

Latest release seems to pass the test on this link https://observablehq.com/@observablehq/module-require-debugger?module=@ax-llm/ax let me know if it works for you.

trebor commented 3 months ago

fantastic! i'll give it a go today, thank you!

trebor commented 3 months ago

sadly it is not working. i'm not 100% sure what's going on, but clicking on the error in the browser it looks like problems occur before these assets are exported.

skypack has a maybe useful hint:

https://cdn.skypack.dev/error/build:@ax-llm/ax@v9.0.23-cIhQosW8959UUKKKxWeL

this is my test notebook:

https://observablehq.com/@trebor-labs/test-ax-llm-ax

the createBinding and exportStar are red herrings from typescript as far as i can see.

dosco commented 2 months ago

according to their debugger this works, gonna continue to look into it I think it's got to do with how we override static fields in AxBaseAI.

https://observablehq.com/@observablehq/module-require-debugger?module=@ax-llm/ax

require('@ax-llm/ax@9.0.31/cjs/index.js').catch(() => window["__createBinding"]);
trebor commented 2 months ago

sadly this still doesn't doesn't work.

i've updated my test notebook.

if you look in the console you can click through and see that 'exports' is not defined, and this is before any of the sub modules are imported. it's transpiled code so it's not fun to read. :(