alex-s-gardner / OpenAI.jl

OpenAI API wrapper for Julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAI API wrapper for Julia

Overview

Provides a Julia wrapper to the OpenAI API. For API functionality see reference documentation.

Usage

using Pkg; Pkg.add("OpenAI")

Quick Start

  1. Create an OpenAI account, if you don't already have one

  2. Create a secrete API key

  3. Choose a model to interact with

secret_key = "PAST_YOUR_SECRETE_KEY_HERE"
model = "gpt-3.5-turbo"
prompt =  "Say \"this is a test\""

r = create_chat(
    secret_key, 
    model,
    [Dict("role" => "user", "content"=> prompt)]
  )
println(r.response[:choices][begin][:message][:content])

returns

"This is a test."

For more use cases see tests.

Feature requests

Feel free to open a PR, or file an issue if that's out of reach!

About

OpenAI API wrapper for Julia

License:MIT License


Languages

Language:Julia 100.0%