Git Product home page Git Product logo

Comments (6)

nvms avatar nvms commented on September 24, 2024 1

I totally agree. This is another one of the things handled by the lib I use for request/response formatting. Specifically, this happens here:

https://github.com/transitive-bullshit/chatgpt-api/blob/main/src/chatgpt-api.ts#L395

Maybe it's time to roll my own solution for this, so that a prompt formatting can be explicitly defined. I'd like to implement this, but need some time to think about how best to do so.

from wingman.

synw avatar synw commented on September 24, 2024 1

I studied this library recently when trying to implement OpenAi support in my server project. It is easy to replace: example code:

from wingman.

synw avatar synw commented on September 24, 2024 1

yes it looks good. I would define a template in a very simple maner. An Alpaca one:

const template = `{system}

### Instruction: fix this invalid json:

'''json
  {prompt}
'''

### Response: (answer in valid json)
`

const system = "You are a javascript code specialist. Below is an instruction that describes a task. Write a response that appropriately completes the request";

const _prompt = '{"a": 1,}';

const finalPrompt = template.replace("{system}", system).replace("{prompt}", _prompt)

where {system} is actually covered by systemMessageTemplate in Wingman

from wingman.

nvms avatar nvms commented on September 24, 2024

Nice, seems easy enough. I should have time to get this done this evening.

How would you expect to define a template? I think I'd probably surface this as an item in the wingman settings panel as e.g. wingman.openai.template, as well as allow it to be overridden by any given command. Does that seem okay to you?

from wingman.

synw avatar synw commented on September 24, 2024

Note about handling the sse request: the eventsource-parser lib is not really necessary: we can handle this manually using a regex, this is what I did in my frontend: example

from wingman.

synw avatar synw commented on September 24, 2024

About templates I just started a little library to manage them more efficiently an use prebuilt template formats: https://github.com/synw/modprompt

I got tired to copy and change text to different template formats depending on the models, so I wrote this to ease the process of using templates in Typescript. It might be useful for Wingman as well

from wingman.

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.