Skip to content

IBM/watsonx-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

watsonx-go

watsonx-go is a watsonx Client for Go

Install

go get -u github.com/IBM/watsonx-go

Usage

import (
  wx "github.com/IBM/watsonx-go/pkg/models"
)

Example Usage

export WATSONX_API_KEY="YOUR WATSONX API KEY"
export WATSONX_PROJECT_ID="YOUR WATSONX PROJECT ID"

Create a client:

client, _ := wx.NewClient()

Or pass in the required secrets directly:

client, err := wx.NewClient(
  wx.WithWatsonxAPIKey(apiKey),
  wx.WithWatsonxProjectID(projectID),
)

Generation:

result, _ := client.GenerateText(
  "meta-llama/llama-3-70b-instruct",
  "Hi, who are you?",
  wx.WithTemperature(0.9),
  wx.WithTopP(.5),
  wx.WithTopK(10),
  wx.WithMaxNewTokens(512),
)

println(result.Text)

Development Setup

Tests

Setup

export WATSONX_API_KEY="YOUR WATSONX API KEY"
export WATSONX_PROJECT_ID="YOUR WATSONX PROJECT ID"

Run

go test ./...

Pre-commit Hooks

Run the following command to run pre-commit formatting:

git config --local core.hooksPath .githooks/

Resources