Skip to content

Commit 5bbfc90

Browse files
author
Your Name
committed
Add example code files to show language diversity on GitHub
1 parent 143a643 commit 5bbfc90

5 files changed

Lines changed: 75 additions & 0 deletions

File tree

examples/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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.

examples/cli.example.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

examples/client.example.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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"))

examples/config.example.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 };

examples/install.example.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 };

0 commit comments

Comments
 (0)