transitive-bullshit / agentic

AI agent stdlib that works with any LLM and TypeScript AI SDK.
https://agentic.so
MIT License
16.5k stars 2.15k forks source link

tighten a bit JSONSchema type #661

Open pelikhan opened 2 months ago

pelikhan commented 2 months ago

Great project! I was playing with adding just enough support in genaiscript to use the agentic function in my script (https://github.com/microsoft/genaiscript/pull/652)

The only issue is a silly typing error because JSONSchema is too loose (https://github.com/transitive-bullshit/agentic/blob/c64069cf9da40536bf2cfe4147ea291ed6700f14/packages/core/src/types.ts#L22) and does not match my own type definition (yay we all have a copy of those)

I was wondering if you could beef up that definition.

transitive-bullshit commented 2 months ago

I'm definitely open to this, though I kind of like being a bit flexible on the JSON Schema types to match OpenAI's ResponseFormatJSONSchema and FunctionParameters types and Vercel AI SDK's CoreTool.Parameters type.

Can you point me to the corresponding type in GenAIScript's source for reference?

pelikhan commented 2 months ago

You'll see that it's a smallish subset of what JSON schemas can do, but mostly what's needed and supported when working with LLMs.

https://github.com/microsoft/genaiscript/blob/main/packages/core/src/types/prompt_template.d.ts#L781