Giter VIP home page Giter VIP logo

gpt-codegen's Introduction

GPT Codegen

BPMN and code generation with integration to OpenAI ChatGPT APIs. This is a proof-of-concept implementation under active development.

Example

The default configuration is set up for BPMN 2.0 process model generation, based upon a description of a business process or a change to an existing process. A simple example is shown below. No details are given for the business process so the model has generated a sensible suggestion

Alt text

Details

The service integrates with Chat GPT 3.5 and 4 models through the OpenAI API. It uses a number of mechanisms to support accurate process model generation

  • Use of an intermediate, JSON Schema-defined data format for interaction with the language model. The language model is instructed on this format and the service handles transformation to and from the more complex & verbose BPMN format

  • Fuzzy matching of model responses. For example, the model will sometimes return additional data, explanation, or formatting even when given specific requests to the contrary

  • Automated validation of model responses. In the case of BPMN generation this involves both validation against the JSON schema, and validation of BPMN model correctness when constructing the process model. The language model is automatically prompted to correct any errors if they are detected, up to a maximum number of iterations

  • Chain-of-thought prompting, The model prompts include zero-shot 'chain of thought' prompting which appears to improve the quality & consistency of model output. This includes prompting the model to generate a step-by-step natural language representation before building the intermediate data format, and requiring it to self-validate output against the provided schema before providing responses

  • Context limitation. The context size grows quickly when dealing with large amount of data, such as these large process model definitions. We generate a new context on every iteration beyond the first which is specifically constrained to:

    • The current user request 'N', wrapped in a prompt template
    • The output of the previous request 'N-1', wrapped in a custom prompt template which defines it as the current state on which the model should apply request N

    We find that the quality of responses is not noticeably degraded by limiting the history in this way. However the model runtime, token usage and cost are significantly reduced. We calculate an approximate token saving between compressed/uncompressed contexts which improves with each request and exceeds 70% saving within a few iterations of BPMN generation.

Instructions

The project includes a Java 17 Spring-based service, and a basic React UI for interacting with the service. No pre-compiled binaries are currently provided since the project is currently in active development. Compiled releases will be provided when the project is more suitable for general usage. If you still wish to run the projects from source you can follow the steps below

To run the example service (./codegen-service)

  1. Ensure you have JDK 17 and Maven installed
  2. Create a file in src/main/resources containing your API Key for Open AI. Update the app.tokenPath property in application.yml (or pass --app.tokenPath=/path/to/token/file when running the app later) to reference your token file
  3. Run mvn clean install to build the application and then java -jar <output-jar>
  4. The application will start serving requests on port 8080 by default, configurable in the application.yml

To run the UI (./codegen-ui)

  1. Ensure you have at least NPM 9.5.1 and NodeJS 18.16.0 installed
  2. Navigate to the codegen-ui directory and run npm install for one-time installation, then npm start to run a development build of the UI

To reiterate, the project is in development mode right now. Feel free to run the application via the steps above but be aware this is for local development and debugging only. A compiled release version will be published once the project is more suitable for general usage.

gpt-codegen's People

Contributors

robjenks avatar spv99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gpt-codegen's Issues

Question Not A Issue

Hello, I was trying to find a way to contact you directly but I did not see one in your profile. Your model touches on something I have been working on. Is there an email or discord or telegram I can contact you on? If there was some other method of reaching out I would have preferred that way lol.

Interested on running the app

Hello,

I'm attempting to run the application, but it seems like the instructions provided are outdated. Could you please update them for running the Java application?

I followed the instructions, but encountered errors when pressing "update process" from the UI. The error message displayed was "Resource not found: /path/to/api-key". In the llm-generation-service app.properties file, I've set the token as token=apikey.txt.

Additionally, I attempted to pass it with -Dgptclient.type=mock, but encountered issues. After installing with mvn clean install, I executed the JAR located in the target directory of llm-generation-service.

It appears that I might be missing something or doing something incorrectly. Could you please provide more detailed instructions or clarify the steps needed to successfully run the application?

Thank you.

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.