modelfusion
modelfusion copied to clipboard
Deno Compatibility
It works "deno run main.ts"
main.ts
import { generateText, openai } from "npm:modelfusion";
But when I am trying to build with deno-esbuild, it seems to not support npm specifiers and therefore would be better if I could import modelfusion package directly from deno.land
const { generateText } = await import("https://deno.land/x/modelfusion/mod.ts");
As a temporary solution, following works:
const { generateText } = await import('https://dev.jspm.io/modelfusion');
@7flash thanks for reporting the issue!
I'm not too familiar with Deno. From your report, my sense is that ideally modelfusion should work with deno-esbuild. Can you tell me the error that you encountered w/ deno-esbuild?
regarding deno.land, is that a separate pkg registry i would need to upload to?
The issue https://github.com/evanw/esbuild/issues/3506 seemed to be resolved by using jspm and though it works for simple case it fails when trying to register tools because of another issue with zod https://github.com/colinhacks/zod/issues/2991
@7flash thanks for reporting the issue!
I'm not too familiar with Deno. From your report, my sense is that ideally modelfusion should work with deno-esbuild. Can you tell me the error that you encountered w/ deno-esbuild?
regarding deno.land, is that a separate pkg registry i would need to upload to?
https://github.com/colinhacks/zod/issues/2991 is not a Zod error. ModelFusion contains something called ZodSchema
as well (I want to change the name to disambiguate, but haven't come up with a better name yet).
See https://github.com/lgrammel/modelfusion/blob/main/src/core/schema/ZodSchema.ts
The error message points to a potential issue with zod-to-json-schema
- do you know if zod to json schema works in deno? ( https://www.npmjs.com/package/zod-to-json-schema )
Is there are a way to provide directy my json schema instead of zod? Because I am building kind of visual editor based on modelfusion where user ends up describing his tools in json format anyway
@7flash yes, you can use new UncheckedSchema
(see https://github.com/lgrammel/modelfusion/blob/main/examples/basic/src/util/schema/generate-structure-unchecked-json-schema-example.ts for an example).
This will not do any validation on the structure of the result tho, just cast it (which could be wrong at runtime).
You can also implement your own schema and json schema acccessor, see https://github.com/lgrammel/modelfusion/blob/main/src/core/schema/Schema.ts and https://github.com/lgrammel/modelfusion/blob/main/src/core/schema/JsonSchemaProducer.ts for the relevant interfaces (they both need to be implemented in a single object / class). That way, you can use other JSON validations like Validbot.
Please note that ModelFusion uses Zod internally for validations that are not related to user-defined schemas.
PS: I've added an uncheckedSchema(...)
facade function in v0.83.0
as well as a zodSchema
facade function to more clearly distinguish from the zod ZodSchema
@lgrammel that's amazing, and here just recorded a demo of visual agent editor I am building with modelfusion: https://youtu.be/V-rI_ughijw
@lgrammel that's amazing, and here just recorded a demo of visual agent editor I am building with modelfusion: https://youtu.be/V-rI_ughijw
Pretty cool! Do you have an open source project or a website? I have started a showcase section on the ModelFusion website, when the project is mature and available, this might be a good fit.
@lgrammel that's amazing, and here just recorded a demo of visual agent editor I am building with modelfusion: https://youtu.be/V-rI_ughijw
Pretty cool! Do you have an open source project or a website? I have started a showcase section on the ModelFusion website, when the project is mature and available, this might be a good fit.
Yes it's here https://github.com/galaxydo/galaxy-polkadot
@lgrammel that's amazing, and here just recorded a demo of visual agent editor I am building with modelfusion: https://youtu.be/V-rI_ughijw
Pretty cool! Do you have an open source project or a website? I have started a showcase section on the ModelFusion website, when the project is mature and available, this might be a good fit.
Yes it's here https://github.com/galaxydo/galaxy-polkadot
Awesome - feel free to send a pull request. The "story teller" example in the showcase shows what needs to be added (section & separate page)