Skip to content

馃 Parakeet 0.2.5 馃ェ [pie]

Choose a tag to compare

@k33g k33g released this 22 Feb 13:18
· 43 commits to main since this release

Release notes

v0.2.5 馃ェ [pie]

Helpers

Estimate the number of tokens in a text

  • content.CountTokens(text string) int
  • content.CountTokensAdvanced(text string) int
  • content.EstimateGPTTokens(text string) int

this could be useful to estimate the value of num_ctx

Extract elements from source code:

  • source.ExtractCodeElements(fileContent string, language string) ([]CodeElement, error)
// CodeElement represents a code structure element (class, function, method)
type CodeElement struct {
	Type        string // "class", "function", "method"
	Name        string
	Signature   string
	Description string
	LineNumber  int
	ParentClass string // For methods
	Parameters  []string
	Source      string // Source code of the element
}

the Signature could be useful to add context to embeddings.

Get and cast environment variable value at the same time:

  • gear.GetEnvFloat(key string, defaultValue float64) float64
  • gear.GetEnvInt(key string, defaultValue int) int
  • gear.GetEnvString(key string, defaultValue string) string

Conversational history + new samples

In Memory

  • Added history.RemoveMessage(id string)
    • see example: 69-web-chat-bot
  • Added history.SaveMessageWithSession(sessionId string, messagesCounters *map[string]int, message llm.Message)
    • see example: 70-web-chat-bot-with-session
  • Added history.RemoveTopMessageOfSession(sessionId string, messagesCounters *map[string]int, conversationLength int)
    • see example: 70-web-chat-bot-with-session

Bbolt Memory

  • Added history.RemoveMessage(id string)
  • Added history.SaveMessageWithSession(sessionId string, messagesCounters *map[string]int, message llm.Message)
    • see example: 71-web-chat-bot-with-session
  • Added history.RemoveTopMessageOfSession(sessionId string, messagesCounters *map[string]int, conversationLength int)
    • see example: 71-web-chat-bot-with-session