Skip to content

Instantly share code, notes, and snippets.

@juanibiapina
Created January 22, 2025 07:45
Show Gist options
  • Save juanibiapina/5c331ce5e3316db7767046be063094c4 to your computer and use it in GitHub Desktop.
Save juanibiapina/5c331ce5e3316db7767046be063094c4 to your computer and use it in GitHub Desktop.
LLM Abstraction
package llm
import "context"
type Llm interface {
CompleteStreaming(ctx context.Context, c Conversation, pch chan string, ch chan string) error
}
type Conversation interface {
Messages() []Message
}
type Role int
const (
RoleUser Role = iota
RoleAssistant
)
type Message struct {
Role Role
Content string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment