GitHub Repository

All our examples are available in our GitHub repository:

OpenFiles Examples

github.com/openfiles-ai/openfiles/tree/main/examplesComplete, runnable projects you can clone and modify

Quick Start Examples

Create a README Generator

import OpenAI from '@openfiles-ai/sdk/openai'

const ai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  openFilesApiKey: process.env.OPENFILES_API_KEY,
  basePath: 'projects'
})

async function generateReadme(projectName: string, description: string) {
  const response = await ai.chat.completions.create({
    model: 'gpt-4',
    messages: [{
      role: 'user',
      content: `Create a comprehensive README.md for a project called "${projectName}". 
                Description: ${description}`
    }]
  })
  
  return response.choices[0].message.content
}

// Usage
const result = await generateReadme(
  'OpenFiles SDK',
  'File storage for AI agents'
)
console.log(result)

Core Client Usage

import { OpenFilesClient } from '@openfiles-ai/sdk/core'

const client = new OpenFilesClient({ 
  apiKey: process.env.OPENFILES_API_KEY 
})

// Create specifications file
await client.writeFile({
  path: 'design/todo-app-specs.md',
  content: 'UI specifications for todo application...'
})

// Read specifications
const specs = await client.readFile({
  path: 'design/todo-app-specs.md'
})

// Implement based on specs
await client.writeFile({
  path: 'code/todo-app.js',
  content: generateTodoAppCode(specs.content)
})

// Create review document
await client.writeFile({
  path: 'reviews/todo-app-review.md',
  content: 'Code review findings...'
})

Running the Examples

  1. Clone the repository
    git clone https://github.com/openfiles-ai/openfiles.git
    cd examples
    
  2. Choose an example
    cd typescript/openai-chat-app
    
  3. Install dependencies
    npm install
    
  4. Set environment variables
    cp .env.example .env
    # Edit .env with your API keys
    
  5. Run the example
    npm run dev
    

Contributing Examples

  1. Fork the examples repository
  2. Create your example in the appropriate language folder
  3. Include a README with setup instructions
  4. Submit a pull request

Get Help