⚡ Live Interactive Code Sandbox: AI Dev Tool: Show HN Offrun
▶️ Run Code
💳 Unlock Source Code ($5)
📝 Editable Code Sandbox
```python # AI Dev Tool: Offrun LLM Context Builder # ======================================= # A CLI automation tool to manage and build LLM contexts from various data sources. import os import json import argparse from typing import List, Dict from pydantic import BaseModel from fastapi import FastAPI, HTTPException from fastapi.responses import JSONResponse from fastapi.requests import Request from fastapi.middleware.cors import CORSMiddleware from transformers import AutoModelForCausalLM, AutoTokenizer # Define the LLM context builder model class LLMContextBuilder(BaseModel): """LLM context builder model""" context: str max_length: int min_length: int # Define the CLI arguments def parse_args(): """Parse CLI arguments""" parser = argparse.ArgumentParser(description="Offrun LLM Context Builder") parser.add_argument("--context", type=str, help="LLM context") parser.add_argument("--max_length", type=int, help="Maximum length of the context") parser.add_argument("--min_length", type=int, help="Minimum length of the context") parser.add_argument("--output", type=str, help="Output file path") return parser.parse_args() #
🖥️ Interactive Execution Terminal Console
⚡ Ready! Click ▶️ Run Code to execute code in browser terminal...