Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rahyanaco/javascript

Repository files navigation

Rahyana API - JavaScript Examples

⚠️ Note: Not all examples are tested yet. Please use with caution and report any issues.

Complete JavaScript examples for the Rahyana AI API with Node.js. Build powerful AI applications with modern JavaScript and async/await patterns.

πŸš€ Quick Start

Prerequisites

  • Node.js 20+ and npm 10+
  • A Rahyana API key (get one at rahyana.ir)

Installation

# Install dependencies
npm install
# Set your API key
export API_KEY_OVERRIDE="your_api_key_here"

Run Examples

# Run basic chat
npm run examples:basic
# Run streaming chat
npm run examples:streaming
# Run all examples
npm run examples:all

πŸ“š Available Examples

Chat Completions (chat-completions/)

  • basic-chat.js - Simple chat completions
  • streaming-chat.js - Real-time streaming responses
  • image-analysis.js - Multimodal image analysis
  • audio-processing.js - Audio processing and transcription
  • pdf-processing.js - PDF document analysis
  • web-search.js - Web search integration
  • tool-calling.js - Function calling examples
  • json-mode.js - Structured JSON responses

Legacy Completions (completions/)

  • legacy-completions.js - Text completion endpoint

Models (models/)

  • get-models.js - List available AI models

Real-World Projects (real-world-projects/)

  • ai-chatbot.js - Complete chatbot implementation
  • ai-code-assistant.js - Code generation and review
  • ai-content-generator.js - Content generation system

Advanced Examples (advanced-examples/)

  • ai-voice-assistant.js - Voice assistant with text fallback
  • ai-data-analyzer.js - Data analysis tool
  • ai-automation-suite.js - Automation workflows
  • ai-web3-integration.js - Web3 and blockchain integration

AI Tools

  • ai-testing/ai-test-generator.js - Intelligent test generation
  • ai-monitoring/ai-performance-monitor.js - Performance monitoring
  • ai-docs/ai-documentation-generator.js - Documentation generation
  • ai-review/ai-code-reviewer.js - Code review assistant
  • ai-devops/ai-cicd-assistant.js - CI/CD automation

πŸ› οΈ Features

  • βœ… Modern ES modules
  • βœ… Async/await patterns
  • βœ… Comprehensive error handling
  • βœ… Streaming support
  • βœ… TypeScript-ready structure
  • βœ… Production-ready code

πŸ“– Usage Examples

Basic Chat

import { basicChat } from './chat-completions/basic-chat.js';
const response = await basicChat({
 apiKey: process.env.API_KEY_OVERRIDE,
 message: 'Hello, Rahyana!'
});
console.log(response);

Streaming Chat

import { streamingChat } from './chat-completions/streaming-chat.js';
for await (const chunk of streamingChat({
 apiKey: process.env.API_KEY_OVERRIDE,
 message: 'Tell me a story'
})) {
 process.stdout.write(chunk);
}

πŸ§ͺ Testing

# Run tests
npm test
# Run with coverage
npm run test:coverage
# Watch mode
npm run test:watch

πŸ”— Related Resources

πŸ“„ License

MIT License - see LICENSE for details.

About

Javascript examples for Rahyana API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /