openai

command
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

OpenAI Example Project

This project demonstrates how to use gorag's OpenAI's API backend.

This code demonstrates using OpenAI embeddings and generation models, along with how RAG overides LLM knowledge by changing an established fact, already learned from the LLMs dataset during the previous training. This provides insight into how RAG can be used to populate new knowledge context, post knowedge cut-off.

Should the demo work correctly, you will see the RAG Content, will claim the moon landings occured in 2023 (without RAG the LLM will state the correct date of 1969)

alt text

Setup

The three main objects needed for OpenAI usage, are an API key, generation model and embeddings model.

This demo uses text-embedding-ada-002 and gpt-3.5-turbo.

The API key should be exported from your environment variables

export OPENAI_API_KEY="MY_KEY"

Usage

Run the main go file

go run examples/openai/main.go

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL