ulai

package module
v0.0.0-...-222be17 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 6 Imported by: 1

README

go-ulai

GoDoc wercker status

an User Local AI API client for Go

Example

package main

import (
	"context"
	"fmt"
	"log"

	ulai "github.com/m0t0k1ch1/go-ulai"
)

func main() {
	client := ulai.NewClient()
	client.SetKey("your API key")

	res, err := client.Chat(context.Background(), "あなたは人工知能?")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(res)
}
人工知能というより人工無脳かな

Documentation

Index

Constants

View Source
const (
	DefaultUri = "https://chatbot-api.userlocal.jp/api/chat"

	ResponseStatusSuccess = "success"
)

Variables

View Source
var (
	ErrNoKey = errors.New("no key")
)

Functions

This section is empty.

Types

type ChatResponse

type ChatResponse struct {
	Status string `json:"status"`
	Result string `json:"result"`
}

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) Chat

func (client *Client) Chat(ctx context.Context, message string) (string, error)

func (*Client) SetKey

func (client *Client) SetKey(key string)

func (*Client) SetUri

func (client *Client) SetUri(uri string)

type Config

type Config struct {
	Uri string
	Key string
}

Jump to

Keyboard shortcuts

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