Skip to content

katallaxie/prompts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

103 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💬 Prompts

Release Go Reference Go Report Card Taylor Swift Volkswagen

A teeny-tiny package to prompt for answers in Ollama, Perplexity, vllm and other OpenAI-compatible API servers.

Usage

client := perplexity.New(
    perplexity.Defaults(prompts.WithApiKey[perplexity.Event](os.Getenv("PPLX_API_KEY")))...)

msgs := []prompts.ChatCompletionMessage{
    {
        Role:    prompts.RoleSystem,
        Content: "You are a helpful assistant. You start every answer with 'Sure my lord!'",
    },
    {
        Role:    prompts.RoleUser,
        Content: "What is the definition of Pi?",
    },
}

req := prompts.NewStreamChatCompletionRequest(msgs...)
req.Model = perplexity.DefaultModel

stream, err := client.SendStreamCompletionRequest(context.Background(), req)
if err != nil {
    panic(err)
}

prompts.Print(stream)

Supported APIs

Docs

You can find the documentation hosted on godoc.org.

Examples

The examples are located in the examples directory.

License

Apache 2.0

About

💬 Prompt for answers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Generated from katallaxie/template-go