Skip to content

h0rv/go-watsonx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-watsonx

Zero dependency watsonx API Client for Go

Install

Install:

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

Import:

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

Example Usage

	model, _ := wx.NewModel(
		wx.WithIBMCloudAPIKey("YOUR IBM CLOUD API KEY"),
		wx.WithWatsonxProjectID("YOUR WATSONX PROJECT ID"),
		wx.WithModel(wx.LLAMA_2_70B_CHAT),
	)

	result, _ := model.GenerateText(
		"Hi, who are you?",
		wx.WithTemperature(0.9),
		wx.WithTopP(.5),
		wx.WithTopK(10),
		wx.WithMaxNewTokens(512),
		wx.WithDecodingMethod(wx.Greedy),
	)

  println(result.Text)

Development Setup

Tests

Setup

export IBMCLOUD_API_KEY="YOUR IBM CLOUD 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