Giter Site home page Giter Site logo

chat-exercises's Introduction

GhatGPT Exercises for Cats Effect ("Chats Effect"?)

This repository contains an empty Scala/Cats project for use in Spacecat training courses.

Licensed Apache 2.0.

Getting Started

  1. To use this repo you'll need to install a Java 11+ compatible JDK. We recommend using Sdkman to do this:

    sdk list java
    sdk install java <VERSION_TAKEN_FROM_THE_LIST>
  2. Clone this repository to a directory on your hard drive:

    git clone https://github.com/spacecatio/cats-sandbox.git
    cd cats-sandbox
  3. Run the sbt.sh script (or use your own locally installed SBT):

    ./sbt.sh
    # Lots of output here. The first run will take a while.
    # You'll see an SBT prompt as follows:
    sbt:sandbox> run
  4. Type run at the SBT prompt to run the sample app:

    sbt:sandbox> run
    # Lots of output here. The first run will take a while.
    # You should finally see the following output:
    Hello world!
  5. Type exit to quit the SBT prompt when you're done:

    sbt:sandbox> exit

Editing Using Visual Studio Code

If you don't have a particular preference for a Scala editor or IDE, we recommend you use Visual Studio Code and a Linux or macOS terminal.

Ideally you should have the code command set up in your terminal, in which case:

cd cats-sandbox
code .

If you don't have the command installed, you can open the code from the file menu:

  1. Choose File Menu > New Window
  2. Choose File Menu > Open Folder... and select the repo root folder

We recommend using your terminal to compile and run your code.

You can optionally install the Metals plugin to add IDE-like features for editing Scala in VSCode. However, please take the time to get this working correctly before your course.

Editing Using IntelliJ IDEA

If you prefer to edit Scala code using IntelliJ IDEA:

  1. Make sure you have the Scala plugin installed
  2. Choose File Menu > Open... and select the build.sbt file from the repo root folder
  3. Choose "Open as Project"

OpenAI API Keys

To use the Chat GPT client library you'll need to create an OpenAI API key:

  1. Go to https://platform.openai.com/

  2. Sign up for an account

  3. Click your profile icon inthe top right and select "View API keys"

  4. Click "Create new secret key", name the key, and copy the key value

  5. Initialise the Chat GPT client in your code as follows:

    import openai.GptService
    
    GptService.resource("secret key goes here")
  6. If you're condiering making your code public, don't commit your secret key to git! Instead, set up an environment variable in your bash/zsh profile and use the following code:

    import openai.GptService
    
    GptService.resource(System.getenv("name of environment variable"))

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.