gpt

package
v0.0.0-...-0e3b330 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCommitMessage

func GenerateCommitMessage(path string) (string, bool)

GenerateCommitMessage generates a commit message based on the changes (git diff) in the current git repository using the OpenAI GPT API

Types

type Content

type Content struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Request

type Request struct {
	Model       string    `json:"model"`
	Messages    []Content `json:"messages"`
	Temperature float64   `json:"temperature"`
}

type Response

type Response struct {
	Id      string `json:"id"`
	Object  string `json:"object"`
	Created int    `json:"created"`
	Model   string `json:"model"`
	Usage   struct {
		PromptTokens     int `json:"prompt_tokens"`
		CompletionTokens int `json:"completion_tokens"`
		TotalTokens      int `json:"total_tokens"`
	} `json:"usage"`
	Choices []struct {
		Message struct {
			Role    string `json:"role"`
			Content string `json:"content"`
		} `json:"message"`
		FinishReason string `json:"finish_reason"`
		Index        int    `json:"index"`
	} `json:"choices"`
}

Jump to

Keyboard shortcuts

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