File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Code Examples
2+
3+ This directory contains example code files demonstrating PersistenceAI integration in various programming languages.
4+
5+ These files are included to help GitHub detect the languages used in the PersistenceAI ecosystem.
6+
7+ ## Files
8+
9+ - \config.example.ts\ - TypeScript configuration example
10+ - \install.example.js\ - JavaScript installation example
11+ - \client.example.py\ - Python API client example
12+ - \cli.example.go\ - Go CLI example
13+
14+ ## Note
15+
16+ These are example files for demonstration purposes. For actual implementation, refer to the main PersistenceAI documentation.
Original file line number Diff line number Diff line change 1+ // Go Example - PersistenceAI CLI
2+ // This file demonstrates Go integration
3+
4+ package main
5+
6+ import "fmt"
7+
8+ type Config struct {
9+ Provider string
10+ Model string
11+ }
12+
13+ func main () {
14+ config := Config {
15+ Provider : "anthropic" ,
16+ Model : "claude-sonnet-4" ,
17+ }
18+ fmt .Printf ("PersistenceAI Config: %+v\n " , config )
19+ }
Original file line number Diff line number Diff line change 1+ # Python Example - PersistenceAI API Client
2+ # This file demonstrates Python integration
3+
4+ class PersistenceAIClient :
5+ def __init__ (self , base_url : str = "http://localhost:4096" ):
6+ self .base_url = base_url
7+
8+ def create_session (self , directory : str ):
9+ """Create a new PersistenceAI session"""
10+ return {"session_id" : "new_session" , "directory" : directory }
11+
12+ if __name__ == "__main__" :
13+ client = PersistenceAIClient ()
14+ print (client .create_session ("/path/to/project" ))
Original file line number Diff line number Diff line change 1+ // TypeScript Example - PersistenceAI Configuration
2+ // This file demonstrates TypeScript usage in PersistenceAI
3+
4+ interface AgentConfig {
5+ name : string ;
6+ model : string ;
7+ tools : string [ ] ;
8+ }
9+
10+ const buildAgent : AgentConfig = {
11+ name : "build" ,
12+ model : "anthropic/claude-sonnet-4" ,
13+ tools : [ "write" , "bash" , "read" ]
14+ } ;
15+
16+ export { buildAgent , type AgentConfig } ;
Original file line number Diff line number Diff line change 1+ // JavaScript Example - PersistenceAI Installation
2+ // This file demonstrates JavaScript usage
3+
4+ const installPersistenceAI = async ( ) => {
5+ const response = await fetch ( 'https://persistence-ai.github.io/Landing/install' ) ;
6+ const script = await response . text ( ) ;
7+ return script ;
8+ } ;
9+
10+ module . exports = { installPersistenceAI } ;
You can’t perform that action at this time.
0 commit comments