Code Monkey home page Code Monkey logo

Comments (5)

dosco avatar dosco commented on August 18, 2024 1

Thanks this looks cool i'll dig in deeper. There are two built in output parsers in GenerateText both are used based on Prompt metadata for example. the param keyValueResponse: true enables splitting the response using a colon seperator.

  1. Key Value Output:
    https://github.com/dosco/minds/blob/50e864f91806c2d723fe6edd46bc3a6a2ecd17d8/src/prompts/extract.ts#L75

  2. Tools / Actions but this one is used internally:
    https://github.com/dosco/minds/blob/50e864f91806c2d723fe6edd46bc3a6a2ecd17d8/src/prompts/answers.ts#L46

I tend to add features based on uses-cases so will try and figure out some to extending our current output parsing the zod librasry that langchain uses can be used by us as well.

from ax.

dosco avatar dosco commented on August 18, 2024

just finished a big refactor to make the api simpler to use and extend. also added support for zod. we now have output parser support for plaintext, simple key-value or a zod schema built in.

The prompts are now super-simple and mostly extend from AIPrompt which does all the heavy lifting. For example see the
https://github.com/dosco/minds/blob/main/src/prompts/zprompt.ts

const prompt = new ZPrompt(zodSchema, actions);
const CustomerResponse = z.object({
  data: z
    .array(
      z.object({
        name: z.string().describe('product name'),
        units: z.number().describe('units in stock'),
        desc: z.string().max(15).describe('product description'),
      })
    )
    .describe('inventory information'),
  response: z.string().max(50).describe('customer response'),
});

const prompt = new ZPrompt(CustomerResponse, actions);

from ax.

Madd0g avatar Madd0g commented on August 18, 2024

Are ZPrompt or zod (or grammars) supported currently? I couldn't find anything

from ax.

dosco avatar dosco commented on August 18, 2024

The whole framework has changed significantly and is now based on the prompt as. a program idea from the Stanford DSP paper. while zod is not supported anymore it's not required you can have typed inputs and outputs on the prompt (prompt signature)

from ax.

dosco avatar dosco commented on August 18, 2024

And you can use asserts to integrate with zod if you still need to.

from ax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.