Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/ayush6624/go-chatgpt
Go-ChatGPT is an open-source GoLang client for ChatGPT, a large language model trained by OpenAI. With Go-ChatGPT, you can quickly and easily integrate ChatGPT's language processing capabilities into your Go applications.
You can install ChatGPT-Go using Go modules:
go get github.com/ayush6624/go-chatgpt
Get your API key from the OpenAI Dashboard - https://platform.openai.com/account/api-keys and export this either as an environment variable, or put this your .bashrc
or .zshrc
export OPENAI_KEY=sk...
In your Go code, import the ChatGPT-Go package:
import (
"github.com/ayush6624/go-chatgpt"
)
Create a new ChatGPT client with your API key
key := os.Getenv("OPENAI_KEY")
client, err := chatgpt.NewClient(key)
if err != nil {
log.Fatal(err)
}
Use the SimpleSend
API to send text to ChatGPT and get a response.
ctx := context.Background()
res, err := c.SimpleSend(ctx, "Hello, how are you?")
if err != nil {
// handle error
}
The SimpleSend method sends the specified text to ChatGPT and returns a response. If an error occurs, it returns an error message.
To use a custom model/parameters, use the Send
API.
ctx := context.Background()
res, err = c.Send(ctx, &chatgpt.ChatCompletionRequest{
Model: chatgpt.GPT35Turbo,
Messages: []chatgpt.ChatMessage{
{
Role: chatgpt.ChatGPTModelRoleSystem,
Content: "Hey, Explain GoLang to me in 2 sentences.",
},
},
})
if err != nil {
// handle error
}
If you want to contribute to this project, feel free to open a PR or an issue.
This package is licensed under MIT license. See LICENSE for details.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.