Giter Club home page Giter Club logo

wtf-chatgpt's Introduction

WTF ChatGPT

I was excited to explore the OpenAI API, so I created a basic command-line interface (CLI) in Java that leverages the GPT-3 API to generate responses. By the end of this tutorial, you will have the ability to generate a native image of the application and execute it directly from your command line. This could be useful when you need to quickly execute a task but don’t know the exact command to do so.

Prerequisites

You need to sign up for an OpenAI account and create an API key. You can do so here: https://beta.openai.com/account/api-keys

Test Drive

If you want to test out the OpenAI API before writing any code you can take a look at gtp.http which contains a sample POST request to the API. You will need to replace YOUR_API_KEY_HERE with your API key.

POST https://api.openai.com/v1/completions
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY_HERE

{
  "model": "text-davinci-001",
  "prompt": "What is the command to list all files in a directory on macOS?",
  "temperature": 1,
  "max_tokens": 100
}

GraalVM

You can collect metadata about your application by enabling the Tracing Agent and defining the output directory.

-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image/

Inspiration

I was inspired by a video from Les Jackson where he built a Chat GPT CLI in .NET.

https://www.youtube.com/watch?v=25i-Dh6U6Cw&t=1299s

wtf-chatgpt's People

Contributors

danvega avatar

Stargazers

 avatar Wladimir Donskoj avatar Angel Alexander Jimenez avatar Kris Martin avatar Devla avatar Mark Stachowski avatar  avatar Alicia Livingston avatar Eric Rainey avatar Alberto Bonacina avatar  avatar

Watchers

 avatar  avatar

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.