Skip to content

h0rv/watsonx-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 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/pkg/models"
)

Example Usage

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

	result, _ := model.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 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

About

watsonx API Client for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 96.2%
  • Shell 3.8%