tellm

module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2024 License: MIT

README

tellm

tellm is a local LLM (Large Language Model) logging tool that allows you to record prompts and responses from your LLM interactions. It provides a simple SDK for logging and retrieving entries, along with a local server for viewing logs.

Setup

Prerequisites
  • Go 1.16 or later
Installation
  1. Clone the repository:
git clone https://github.com/santiagomed/tellm.git
cd tellm
  1. Build the server:
cd cmd/server
go build

Usage

Running the Server

To start the tellm server:

./server

The server will start on http://localhost:8080.

Using the SDK

To use the tellm SDK in your Go project:

  1. Add the SDK to your project:
go get github.com/santiagomed/tellm/sdk
  1. Import and use the SDK in your code:
package main

import (
	"fmt"
	"log"

	"github.com/santiagomed/tellm/sdk"
)

func main() {
	client := sdk.NewClient("http://localhost:8080")

	// Log a prompt and response
	err := client.Log("What is the capital of France?", "The capital of France is Paris.")
	if err != nil {
		log.Fatalf("Failed to log: %v", err)
	}

	// Retrieve all logs
	logs, err := client.GetLogs()
	if err != nil {
		log.Fatalf("Failed to get logs: %v", err)
	}

	// Print the logs
	for _, entry := range logs {
		fmt.Printf("Timestamp: %s\nPrompt: %s\nResponse: %s\n\n", entry.Timestamp, entry.Prompt, entry.Response)
	}
}

Viewing Logs

Open http://localhost:8080 in your web browser to view the logged entries in a simple HTML interface.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL