Skip to content

wit-ai/wit-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

405b741 · Feb 27, 2025

History

82 Commits
Jul 24, 2024
Feb 27, 2025
Feb 27, 2025
Jul 24, 2024
Nov 1, 2018
Nov 1, 2018
May 17, 2019
Sep 27, 2018
May 17, 2019
Feb 27, 2025
Jul 24, 2024
Dec 5, 2020
Feb 27, 2025
Jul 24, 2024
Jul 24, 2024
May 17, 2019
May 17, 2019
Jul 24, 2024
Feb 27, 2025
Jul 24, 2024
Nov 22, 2020
Jul 24, 2024
Jun 26, 2019
Jul 24, 2024
Sep 28, 2022
Jul 24, 2024
Nov 22, 2020
Jul 24, 2024
Apr 22, 2021
Jul 24, 2024
Nov 20, 2020

Repository files navigation

wit.ai

Go Reference

This repository is community-maintained. We gladly accept pull requests. Please see the Wit HTTP Reference for all supported endpoints.

Go client for wit.ai HTTP API.

API version: 20240304

Install

go get -u github.com/wit-ai/wit-go/v2

Usage

package main

import (
    "os"
    "fmt"

    witai "github.com/wit-ai/wit-go/v2"
)

func main() {
    client := witai.NewClient(os.Getenv("WIT_AI_TOKEN"))
    // Use client.SetHTTPClient() to set custom http.Client

    msg, _ := client.Parse(&witai.MessageRequest{
        Query: "hello",
    })
    fmt.Printf("%v", msg)
}

Testing

Unit tests are executed by Github Actions.

Unit tests

go test -race -v

Integration tests

Integration tests have to be executed manually by providing a valid token via WITAI_INTEGRATION_TOKEN env var.

Integration tests are connecting to real Wit.ai API, so you need to provide a valid token:

WITAI_INTEGRATION_TOKEN={SERVER_ACCESS_TOKEN} go test -v -tags=integration

License

The license for wit-go can be found in LICENSE file in the root directory of this source tree.

Terms of Use

Our terms of use can be found at https://opensource.facebook.com/legal/terms.

Privacy Policy

Our privacy policy can be found at https://opensource.facebook.com/legal/privacy.