adapter over LLMs interface
sub-module | doc | about |
---|---|---|
chatter types | ||
AWS Bedrock LLMs | ||
AWS Bedrock Batch Inference | ||
OpenAI LLMs |
The library is adapter over various popular Large Language Models (LLMs) tuned for text generation: AWS BedRock, OpenAI.
A good prompt has 4 key elements: Role, Task, Requirements, Instructions. "Are You AI Ready? Investigating AI Tools in Higher Education – Student Guide"
In the research community, there was an attempt for making standardized taxonomy of prompts for large language models (LLMs) to solve complex tasks. It encourages the community to adopt the TELeR taxonomy to achieve meaningful comparisons among LLMs, facilitating more accurate conclusions and helping the community achieve consensus on state-of-the-art LLM performance more efficiently.
The library addresses the LLMs comparisons by
- Creating generic trait to "interact" with LLMs;
- Enabling prompt definition into seven distinct levels;
- Supporting variety of LLMs.
type Chatter interface {
Prompt(context.Context, encoding.TextMarshaler, ...func(*Options)) (string, error)
}
The latest version of the library is available at main
branch of this repository. All development, including new features and bug fixes, take place on the main
branch using forking and pull requests as described in contribution guidelines. The stable version is available via Golang modules.
package main
import (
"context"
"fmt"
"github.com/kshard/chatter"
"github.com/kshard/chatter/bedrock"
)
func main() {
assistant, err := bedrock.New(
bedrock.WithLLM(bedrock.LLAMA3_0_8B_INSTRUCT),
)
if err != nil {
panic(err)
}
var prompt chatter.Prompt
prompt.WithTask("Extract keywords from the text: %s", /* ... */)
reply, err := assistant.Prompt(context.Background(), &prompt)
if err != nil {
panic(err)
}
fmt.Printf("==> (%d)\n%s\n", assistant.ConsumedTokens(), reply)
}
The library is MIT licensed and accepts contributions via GitHub pull requests:
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
The build and testing process requires Go version 1.21 or later.
build and test library.
git clone https://github.com/kshard/chatter
cd chatter
go test ./...
The commit message helps us to write a good release note, speed-up review process. The message should address two question what changed and why. The project follows the template defined by chapter Contributing to a Project of Git book.
If you experience any issues with the library, please let us know via GitHub issues. We appreciate detailed and accurate reports that help us to identity and replicate the issue.