repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/work.py
inference/worker/work.py
import re from concurrent import futures import chat_chain import interface import requests import transformers import utils import websocket from chat_chain_prompts import ( ASSISTANT_PREFIX, CUSTOM_INSTRUCTIONS_PREFIX, END_SEQ, OBSERVATION_SEQ, START_SEQ, THOUGHT_SEQ, ) from loguru import log...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/basic_hf_server.py
inference/worker/basic_hf_server.py
""" Basic FastAPI server to serve models using HuggingFace Transformers library. This is an alternative to running the HuggingFace `text-generation-inference` (tgi) server. """ import sys import threading from queue import Queue import fastapi import hf_stopping import hf_streamer import interface import torch import...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/download_model.py
inference/worker/download_model.py
import os import signal import sys import transformers def terminate(signum, frame): print("Terminating...") sys.exit(0) if __name__ == "__main__": signal.signal(signal.SIGINT, terminate) model_id = os.getenv("MODEL_ID") if "llama" in model_id.lower(): transformers.LlamaTokenizer.from_p...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/openapi_parser.py
inference/worker/openapi_parser.py
import json from urllib.parse import urlsplit import requests import yaml from loguru import logger from oasst_shared.schemas import inference def fetch_openapi_spec(url): response = requests.get(url) if response.status_code != 200: raise Exception(f"Failed to fetch data from URL: {url}. Status code:...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/get_model_config_prop.py
inference/worker/get_model_config_prop.py
import sys from oasst_shared import model_configs from settings import settings if __name__ == "__main__": model_config = model_configs.MODEL_CONFIGS.get(settings.model_config_name) if model_config is None: print(f"Unknown model config name: {settings.model_config_name}") sys.exit(2) if le...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/hf_langchain_inference.py
inference/worker/hf_langchain_inference.py
import interface import utils from langchain.llms.base import LLM class HFInference(LLM): """LangChain LLM implementation which uses the HF inference server configured in the worker settings.""" max_new_tokens: int = 512 top_k: int | None = None top_p: float | None = None typical_p: float | None ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/chat_chain.py
inference/worker/chat_chain.py
import datetime import interface import transformers import utils import websocket from chat_chain_prompts import ( ASSISTANT_PREFIX, CUSTOM_INSTRUCTIONS_PREFIX, HUMAN_PREFIX, JSON_FORMAT_NO_PAYLOAD, JSON_FORMAT_PAYLOAD, OBSERVATION_SEQ, PREFIX, SUFFIX, THOUGHT_SEQ, ) from chat_chai...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/__main__.py
inference/worker/__main__.py
import concurrent.futures import signal import sys import time from contextlib import closing import pydantic import transformers import utils import websocket import work from loguru import logger from oasst_shared import model_configs from oasst_shared.schemas import inference from settings import settings def ter...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/interface.py
inference/worker/interface.py
from typing import Literal import pydantic from oasst_shared.schemas import inference class GenerateStreamParameters(pydantic.BaseModel): max_new_tokens: int = 1024 do_sample: bool = True top_k: int | None = None top_p: float | None = None typical_p: float | None = None temperature: float | N...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/utils.py
inference/worker/utils.py
import collections import random import threading import time from typing import Iterable, Literal import interface import lorem import pydantic import requests import sseclient import transformers import websocket from loguru import logger from oasst_shared.schemas import inference from settings import settings shar...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/download_model_hf.py
inference/worker/download_model_hf.py
import os import signal import sys from pathlib import Path import huggingface_hub def terminate(signum, frame): print("Terminating...") sys.exit(0) if __name__ == "__main__": signal.signal(signal.SIGINT, terminate) model_id = os.getenv("MODEL_ID") snapshot_dir = Path(huggingface_hub.snapshot_d...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/settings.py
inference/worker/settings.py
import pydantic class Settings(pydantic.BaseSettings): backend_url: str = "ws://localhost:8000" model_config_name: str = "distilgpt2" inference_server_url: str = "http://localhost:8001" inference_server_route: str = "/generate_stream" safety_server_url: str = "http://localhost:8002" api_key: s...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/chat_chain_prompts.py
inference/worker/chat_chain_prompts.py
ASSISTANT_PREFIX = "Open Assistant" HUMAN_PREFIX = "Human" OBSERVATION_SEQ = "Observation:" THOUGHT_SEQ = "Thought:" START_SEQ = "Begin!" END_SEQ = "End!" CUSTOM_INSTRUCTIONS_PREFIX = """The following details have been shared by the user about themselves. This user profile appears to you in every conversation they eng...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/chat_chain_utils.py
inference/worker/chat_chain_utils.py
import json import re from typing import Callable import requests import transformers from chat_chain_prompts import INSTRUCTIONS, OBSERVATION_SEQ, TOOLS_PREFIX from hf_langchain_inference import HFInference from langchain.agents import Tool from langchain.memory import ConversationBufferMemory from langchain.prompts ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/hf_streamer.py
inference/worker/hf_streamer.py
import typing import transformers from loguru import logger class Printer(typing.Protocol): def __call__(self, value: int) -> None: ... def _unpack(value): if len(value.shape) > 1 and value.shape[0] > 1: raise ValueError("HFStreamer only supports batch size 1") elif len(value.shape) > 1...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/worker/hf_stopping.py
inference/worker/hf_stopping.py
import torch from tokenizers import Tokenizer from transformers import StoppingCriteria class SequenceStoppingCriteria(StoppingCriteria): """Enables automatic stopping of model text generation when specific text sequences are generated.""" def __init__( self, tokenizer: Tokenizer, sto...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/text-client/__main__.py
inference/text-client/__main__.py
"""Simple REPL frontend.""" import time import text_client_utils as utils import typer from loguru import logger app = typer.Typer() @app.command() def main(backend_url: str = "http://127.0.0.1:8000", model_config_name="distilgpt2", username="test1"): """Simple REPL client.""" while True: try: ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/text-client/text_client_utils.py
inference/text-client/text_client_utils.py
import json import requests import sseclient from loguru import logger class DebugClient: def __init__(self, backend_url, http_client=requests): self.backend_url = backend_url self.http_client = http_client self.auth_headers = None self.available_models = self.get_available_models...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/tests/locust/locustfile.py
inference/tests/locust/locustfile.py
import random import string import sys import time from pathlib import Path from locust import HttpUser, between, task sys.path.append(str(Path(__file__).parent.parent.parent / "text-client")) import text_client_utils as utils # noqa: E402 class ChatUser(HttpUser): wait_time = between(1, 2) conversation_le...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/export.py
inference/server/export.py
"""Script to facilitate exporting chat data from the server database.""" import argparse import asyncio import contextlib import datetime as dt import gzip import json import sys from collections import defaultdict from pathlib import Path from typing import Any, TextIO import sqlalchemy import sqlmodel from fastapi....
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/main.py
inference/server/main.py
import asyncio import math import signal import sys import fastapi import redis.asyncio as redis import sqlmodel from fastapi.middleware.cors import CORSMiddleware from fastapi_limiter import FastAPILimiter from loguru import logger from oasst_inference_server import database, deps, models, plugins from oasst_inferenc...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/user_chat_repository.py
inference/server/oasst_inference_server/user_chat_repository.py
import fastapi import pydantic import sqlalchemy.orm import sqlmodel from loguru import logger from oasst_inference_server import database, models from oasst_inference_server.settings import settings from oasst_shared.schemas import inference class UserChatRepository(pydantic.BaseModel): """Wrapper around a datab...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/deps.py
inference/server/oasst_inference_server/deps.py
import contextlib import fastapi import redis.asyncio as redis from fastapi import Depends from fastapi_limiter.depends import RateLimiter from oasst_inference_server import auth from oasst_inference_server.chat_repository import ChatRepository from oasst_inference_server.database import AsyncSession, get_async_sessio...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/admin.py
inference/server/oasst_inference_server/admin.py
"""Logic related to admin actions.""" import fastapi from loguru import logger from oasst_inference_server import database, models from oasst_shared import utils as shared_utils async def delete_user_from_db(session: database.AsyncSession, user_id: str): """Deletes a user.""" logger.info(f"Deleting user {use...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/plugin_utils.py
inference/server/oasst_inference_server/plugin_utils.py
import asyncio import json import aiohttp import yaml from aiohttp.client_exceptions import ClientConnectorError, ServerTimeoutError from fastapi import HTTPException from loguru import logger from oasst_shared.schemas import inference async def attempt_fetch_plugin(session: aiohttp.ClientSession, url: str, timeout:...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/chat_repository.py
inference/server/oasst_inference_server/chat_repository.py
import datetime import fastapi import pydantic import sqlalchemy.orm import sqlmodel from loguru import logger from oasst_inference_server import database, models from oasst_inference_server.schemas import chat as chat_schema from oasst_inference_server.settings import settings from oasst_shared.schemas import inferen...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/worker_utils.py
inference/server/oasst_inference_server/worker_utils.py
import enum import uuid import fastapi import pydantic import sqlalchemy.orm import sqlmodel from fastapi import Depends from loguru import logger from oasst_inference_server import database, deps, models from oasst_shared.schemas import inference class WorkerSessionStatus(str, enum.Enum): waiting = "waiting" ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/queueing.py
inference/server/oasst_inference_server/queueing.py
import redis.asyncio as redis from oasst_inference_server.settings import settings class QueueFullException(Exception): pass class RedisQueue: def __init__( self, redis_client: redis.Redis, queue_id: str, expire: int | None = None, with_counter: bool = False, ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/database.py
inference/server/oasst_inference_server/database.py
import json from pathlib import Path import alembic.command import alembic.config import pydantic.json from loguru import logger from oasst_inference_server.schemas import chat as chat_schema from oasst_inference_server.settings import settings from oasst_shared.schemas import inference from sqlalchemy.ext.asyncio imp...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/settings.py
inference/server/oasst_inference_server/settings.py
from typing import Any import pydantic def split_keys_string(keys: str | None): if not keys: return [] return list(filter(bool, keys.split(","))) class Settings(pydantic.BaseSettings): PROJECT_NAME: str = "open-assistant inference server" redis_host: str = "localhost" redis_port: int = ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/compliance.py
inference/server/oasst_inference_server/compliance.py
"""Logic related to worker compliance checks, which seek to ensure workers do not produce malicious responses.""" import datetime from typing import cast import fastapi import sqlmodel from loguru import logger from oasst_inference_server import database, deps, models, worker_utils from oasst_inference_server.setting...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/__init__.py
inference/server/oasst_inference_server/__init__.py
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/chat_utils.py
inference/server/oasst_inference_server/chat_utils.py
from oasst_inference_server.settings import settings from oasst_shared import model_configs def get_model_config(model_config_name: str) -> model_configs.ModelConfig: """Get a `ModelConfig` by its name. See `oasst_shared.model_configs`.""" if settings.allowed_model_config_names != "*": if model_config...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/auth.py
inference/server/oasst_inference_server/auth.py
"""Logic related to authorization actions.""" import hashlib import json from datetime import datetime, timedelta import sqlmodel from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.kdf.hkdf import HKDF from fastapi import HTTPException, Security from fastapi.security import APIKeyHe...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/schemas/chat.py
inference/server/oasst_inference_server/schemas/chat.py
import datetime from typing import Annotated, Literal, Union import pydantic from oasst_shared.schemas import inference class CreatePrompterMessageRequest(pydantic.BaseModel): parent_id: str | None = None content: str = pydantic.Field(..., repr=False) class CreateAssistantMessageRequest(pydantic.BaseModel)...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/schemas/worker.py
inference/server/oasst_inference_server/schemas/worker.py
import pydantic class CreateWorkerRequest(pydantic.BaseModel): name: str trusted: bool = False class WorkerRead(pydantic.BaseModel): id: str name: str api_key: str trusted: bool class Config: orm_mode = True
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/schemas/__init__.py
inference/server/oasst_inference_server/schemas/__init__.py
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/schemas/auth.py
inference/server/oasst_inference_server/schemas/auth.py
import json from base64 import b64decode import pydantic from pydantic import validator class TrustedClient(pydantic.BaseModel): api_key: str client: str # "website", "discord", or similar user_id: str # the id of the user in the data backend provider_account_id: str # id of the user in the client...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/routes/admin.py
inference/server/oasst_inference_server/routes/admin.py
import fastapi import sqlmodel from fastapi import Depends, HTTPException, Security from loguru import logger from oasst_inference_server import admin, auth, database, deps, models from oasst_inference_server.schemas import worker as worker_schema from oasst_inference_server.settings import settings router = fastapi.A...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/routes/account.py
inference/server/oasst_inference_server/routes/account.py
import fastapi from fastapi import Depends from oasst_inference_server import admin, auth, database, deps router = fastapi.APIRouter( prefix="/account", tags=["account"], ) @router.delete("/") async def handle_account_deletion( user_id: str = Depends(auth.get_current_user_id), session: database.Async...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/routes/configs.py
inference/server/oasst_inference_server/routes/configs.py
import fastapi import pydantic from fastapi import HTTPException from loguru import logger from oasst_inference_server import plugin_utils from oasst_inference_server.plugins import plugin_apps from oasst_inference_server.settings import settings from oasst_shared import model_configs from oasst_shared.schemas import i...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/routes/workers.py
inference/server/oasst_inference_server/routes/workers.py
import asyncio import datetime from typing import cast import fastapi import pydantic import websockets.exceptions from loguru import logger from oasst_inference_server import chat_repository, database, deps, models, queueing, worker_utils from oasst_inference_server.schemas import chat as chat_schema from oasst_infer...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/routes/chats.py
inference/server/oasst_inference_server/routes/chats.py
import asyncio import base64 import fastapi import pydantic from fastapi import Depends, Query from loguru import logger from oasst_inference_server import auth, chat_utils, deps, models, queueing from oasst_inference_server.schemas import chat as chat_schema from oasst_inference_server.settings import settings from o...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/routes/auth.py
inference/server/oasst_inference_server/routes/auth.py
import fastapi import sqlmodel from authlib.integrations.starlette_client import OAuth from fastapi import Depends, HTTPException, Request, Security from google.oauth2.credentials import Credentials from googleapiclient.discovery import build from loguru import logger from oasst_inference_server import auth, database, ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/models/chat.py
inference/server/oasst_inference_server/models/chat.py
import datetime import sqlalchemy as sa import sqlalchemy.dialects.postgresql as pg from oasst_inference_server.schemas import chat as chat_schema from oasst_shared.schemas import inference from sqlmodel import Field, Relationship, SQLModel from uuid_extensions import uuid7str class DbMessage(SQLModel, table=True): ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/models/user.py
inference/server/oasst_inference_server/models/user.py
from uuid import uuid4 import sqlalchemy as sa from sqlmodel import Field, Index, SQLModel class DbUser(SQLModel, table=True): __tablename__ = "user" __table_args__ = (Index("provider", "provider_account_id", unique=True),) id: str = Field(default_factory=lambda: str(uuid4()), primary_key=True) pro...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/models/worker.py
inference/server/oasst_inference_server/models/worker.py
import datetime import enum from uuid import uuid4 import sqlalchemy as sa import sqlalchemy.dialects.postgresql as pg from loguru import logger from oasst_inference_server.settings import settings from oasst_shared.schemas import inference from sqlmodel import Field, Relationship, SQLModel from uuid_extensions import...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/models/__init__.py
inference/server/oasst_inference_server/models/__init__.py
from .chat import DbChat, DbMessage, DbMessageEval, DbReport from .user import DbRefreshToken, DbUser from .worker import DbWorker, DbWorkerComplianceCheck, DbWorkerEvent, WorkerEventType __all__ = [ "DbChat", "DbMessage", "DbMessageEval", "DbReport", "DbRefreshToken", "DbUser", "DbWorker",...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/plugins/__init__.py
inference/server/oasst_inference_server/plugins/__init__.py
from oasst_inference_server.plugins.gale_pleaser.main import app as gale_pleaser from oasst_inference_server.plugins.gale_roaster.main import app as gale_roaster from oasst_inference_server.plugins.web_retriever.main import app as web_retriever # dict of registered plugins # The key defines a plugin's path which will ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/plugins/gale_roaster/main.py
inference/server/oasst_inference_server/plugins/gale_roaster/main.py
import json from pathlib import Path from fastapi import FastAPI, Query, Request, Response from fastapi.middleware.cors import CORSMiddleware from fastapi.openapi.utils import get_openapi folder_path = Path(__file__).parent app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_c...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/plugins/gale_pleaser/main.py
inference/server/oasst_inference_server/plugins/gale_pleaser/main.py
import json from pathlib import Path from fastapi import FastAPI, Query, Request, Response from fastapi.middleware.cors import CORSMiddleware from fastapi.openapi.utils import get_openapi from loguru import logger folder_path = Path(__file__).parent app = FastAPI() app.add_middleware( CORSMiddleware, allow_...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/oasst_inference_server/plugins/web_retriever/main.py
inference/server/oasst_inference_server/plugins/web_retriever/main.py
import codecs import io import json import re from pathlib import Path import aiohttp import PyPDF2 import yaml from bs4 import BeautifulSoup from fastapi import FastAPI, Query, Request, Response from fastapi.middleware.cors import CORSMiddleware from fastapi.openapi.utils import get_openapi from fastapi.responses imp...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/env.py
inference/server/alembic/env.py
import asyncio from logging.config import fileConfig import sqlmodel from alembic import context from loguru import logger from oasst_inference_server import models # noqa: F401 from sqlalchemy import engine_from_config, pool, text from sqlalchemy.ext.asyncio import AsyncEngine # this is the Alembic Config object, w...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_04_24_2130-401eef162771_add_chat_data_opt_out_field.py
inference/server/alembic/versions/2023_04_24_2130-401eef162771_add_chat_data_opt_out_field.py
"""Add chat data opt out field Revision ID: 401eef162771 Revises: b66fd8f9da1f Create Date: 2023-04-24 21:30:19.947411 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "401eef162771" down_revision = "b66fd8f9da1f" branch_labels = None depends_on = None def upgr...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_03_12_1742-7d5be54acd49_initial_revision.py
inference/server/alembic/versions/2023_03_12_1742-7d5be54acd49_initial_revision.py
"""initial revision Revision ID: 7d5be54acd49 Revises: Create Date: 2023-03-12 17:42:42.807459 """ import sqlalchemy as sa import sqlmodel from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "7d5be54acd49" down_revision = None branch_labels = None dep...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_05_29_1551-5ed411a331f4_add_active_thread_tail_messsage_id_and_.py
inference/server/alembic/versions/2023_05_29_1551-5ed411a331f4_add_active_thread_tail_messsage_id_and_.py
"""add_active_thread_tail_messsage_id_and_message_eval Revision ID: 5ed411a331f4 Revises: 5b4211625a9f Create Date: 2023-05-29 15:51:41.857262 """ import sqlalchemy as sa import sqlmodel from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "5ed411a331f...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_04_14_1611-b66fd8f9da1f_add_hidden_field_to_chats.py
inference/server/alembic/versions/2023_04_14_1611-b66fd8f9da1f_add_hidden_field_to_chats.py
"""Add hidden field to chats Revision ID: b66fd8f9da1f Revises: f0e18084aae4 Create Date: 2023-04-14 16:11:35.361507 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "b66fd8f9da1f" down_revision = "f0e18084aae4" branch_labels = None depends_on = None def upgrad...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_03_21_2116-629d5081160f_changed_worker_config_to_worker_info.py
inference/server/alembic/versions/2023_03_21_2116-629d5081160f_changed_worker_config_to_worker_info.py
"""changed worker config to worker info Revision ID: 629d5081160f Revises: 7d5be54acd49 Create Date: 2023-03-21 21:16:57.999842 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "629d5081160f" down_revision = "7d5be54acd4...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_05_01_2253-5b4211625a9f_added_used_plugin_to_message.py
inference/server/alembic/versions/2023_05_01_2253-5b4211625a9f_added_used_plugin_to_message.py
"""added used plugin to message Revision ID: 5b4211625a9f Revises: ea19bbc743f9 Create Date: 2023-05-01 22:53:16.297495 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "5b4211625a9f" down_revision = "ea19bbc743f9" branc...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_04_29_1739-ea19bbc743f9_add_safe_content_to_message.py
inference/server/alembic/versions/2023_04_29_1739-ea19bbc743f9_add_safe_content_to_message.py
"""Add safe_content to message Revision ID: ea19bbc743f9 Revises: 401eef162771 Create Date: 2023-04-14 22:37:41.373382 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "ea19bbc743f9" down_revision = "401eef162771" branch_labels = None depends_on =...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_04_12_2033-f0e18084aae4_add_deleted_field_to_user.py
inference/server/alembic/versions/2023_04_12_2033-f0e18084aae4_add_deleted_field_to_user.py
"""Add deleted field to user Revision ID: f0e18084aae4 Revises: 78f16015b904 Create Date: 2023-04-12 20:33:28.239793 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "f0e18084aae4" down_revision = "78f16015b904" branch_labels = None depends_on = None def upgrad...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/server/alembic/versions/2023_03_22_2113-78f16015b904_add_refresh_token_table.py
inference/server/alembic/versions/2023_03_22_2113-78f16015b904_add_refresh_token_table.py
"""Add refresh token table Revision ID: 78f16015b904 Revises: 629d5081160f Create Date: 2023-03-22 21:13:41.411718 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "78f16015b904" down_revision = "629d5081160f" branch_labels = None depends_on = Non...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/safety/main.py
inference/safety/main.py
""" A simple FastAPI server which serves a `blade2blade2` safety model. See https://github.com/LAION-AI/blade2blade for context. """ import asyncio from concurrent.futures import ThreadPoolExecutor import fastapi import uvicorn from blade2blade import Blade2Blade from loguru import logger from oasst_shared.schemas i...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/inference/safety/settings.py
inference/safety/settings.py
import pydantic class Settings(pydantic.BaseSettings): # HuggingFace model ID for the model to load in blade2blade safety_model_name: str = "shahules786/blade2blade-t5-base" settings = Settings()
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/notebooks/data-augmentation/anthropic/trainer.py
notebooks/data-augmentation/anthropic/trainer.py
import numpy as np from datasets import load_dataset from sklearn.metrics import f1_score from torch.utils.data import Dataset from transformers import AutoModelForSequenceClassification, AutoTokenizer, Trainer, TrainingArguments MAXLEN = 128 BATCH_SIZE = 128 MODEL = "roberta-base" LABEL2ID = { "__casual__": 0, ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/model_configs.py
oasst-shared/oasst_shared/model_configs.py
import pydantic class ModelConfig(pydantic.BaseModel): model_id: str max_input_length: int = 512 max_total_length: int = 1024 quantized: bool = False @property def is_llama(self) -> bool: return "llama" in self.model_id.lower() @property def is_lorem(self) -> bool: re...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/api_client.py
oasst-shared/oasst_shared/api_client.py
"""API Client for interacting with the OASST backend.""" import enum import typing as t from http import HTTPStatus from typing import Optional, Type from uuid import UUID import aiohttp from loguru import logger from oasst_shared.exceptions.oasst_api_error import OasstError, OasstErrorCode from oasst_shared.schemas i...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/utils.py
oasst-shared/oasst_shared/utils.py
import hashlib import time from datetime import datetime, timezone from functools import wraps from loguru import logger DELETED_USER_DISPLAY_NAME = "Deleted User" DELETED_USER_ID_PREFIX = "deleted_" def utcnow() -> datetime: """Return the current utc date and time with tzinfo set to UTC.""" return datetime...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/__init__.py
oasst-shared/oasst_shared/__init__.py
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/schemas/inference.py
oasst-shared/oasst_shared/schemas/inference.py
import enum import platform import random import uuid from datetime import datetime from typing import Annotated, Literal, Union import psutil import pydantic import pynvml from oasst_shared.model_configs import ModelConfig INFERENCE_PROTOCOL_VERSION = "1" class WorkerGpuInfo(pydantic.BaseModel): name: str ...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/schemas/__init__.py
oasst-shared/oasst_shared/schemas/__init__.py
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/schemas/protocol.py
oasst-shared/oasst_shared/schemas/protocol.py
import enum from datetime import datetime from typing import List, Literal, Optional, Union from uuid import UUID, uuid4 import pydantic from oasst_shared.exceptions import OasstErrorCode from pydantic import BaseModel, Field, conint, conlist, constr class TaskRequestType(str, enum.Enum): random = "random" s...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/exceptions/oasst_api_error.py
oasst-shared/oasst_shared/exceptions/oasst_api_error.py
from enum import IntEnum from http import HTTPStatus class OasstErrorCode(IntEnum): """ Error codes of the Open-Assistant backend API. Ranges: 0-1000: general errors 1000-2000: tasks endpoint 2000-3000: prompt_repository, task_repository, user_repository 3000-4000: external res...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/oasst_shared/exceptions/__init__.py
oasst-shared/oasst_shared/exceptions/__init__.py
# Ignore unused imports; these are re-exported from .oasst_api_error import OasstError as OasstError # noqa: F401 from .oasst_api_error import OasstErrorCode as OasstErrorCode # noqa: F401
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/tests/__init__.py
oasst-shared/tests/__init__.py
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
LAION-AI/Open-Assistant
https://github.com/LAION-AI/Open-Assistant/blob/f1e6ed9526f5817531f3ab85441a40b3671ddccb/oasst-shared/tests/test_oasst_api_client.py
oasst-shared/tests/test_oasst_api_client.py
from typing import Any from unittest import mock from uuid import uuid4 import aiohttp import pytest from oasst_shared.api_client import OasstApiClient from oasst_shared.exceptions import OasstError, OasstErrorCode from oasst_shared.schemas import protocol as protocol_schema @pytest.fixture def oasst_api_client_mock...
python
Apache-2.0
f1e6ed9526f5817531f3ab85441a40b3671ddccb
2026-01-04T14:41:20.303953Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/yank-old-versions.py
scripts/yank-old-versions.py
import requests from packaging import version from packaging.specifiers import SpecifierSet def get_versions_supporting_python38_or_lower(package_name): url = f"https://pypi.org/pypi/{package_name}/json" response = requests.get(url) if response.status_code != 200: print(f"Failed to fetch data for ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/redact-cast.py
scripts/redact-cast.py
#!/usr/bin/env python3 import json import sys import pyte from tqdm import tqdm from aider.dump import dump # noqa def main(): if len(sys.argv) != 3: print(f"Usage: {sys.argv[0]} input_cast_file output_cast_file") sys.exit(1) input_file = sys.argv[1] output_file = sys.argv[2] # Co...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/versionbump.py
scripts/versionbump.py
#!/usr/bin/env python import argparse import datetime import os import re import subprocess import sys from packaging import version # Function to check if we are on the main branch def check_branch(): branch = subprocess.run( ["git", "rev-parse", "--abbrev-ref", "HEAD"], capture_output=True, text=True ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/my_models.py
scripts/my_models.py
#!/usr/bin/env python3 import json from collections import defaultdict, deque from pathlib import Path def collect_model_stats(n_lines=1000): """Collect model usage statistics from the analytics file.""" analytics_path = Path.home() / ".aider" / "analytics.jsonl" model_stats = defaultdict(int) with ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/clean_metadata.py
scripts/clean_metadata.py
#!/usr/bin/env python import difflib import json import re from pathlib import Path import json5 def find_block_lines(lines, key_to_remove): """Finds the start and end line indices for a top-level key's block.""" start_line_idx = -1 # Regex to find the line starting the key definition, allowing for whit...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/tsl_pack_langs.py
scripts/tsl_pack_langs.py
#!/usr/bin/env python3 import json import os import sys import time import requests def get_default_branch(owner, repo): """Get the default branch of a GitHub repository using the API.""" api_url = f"https://api.github.com/repos/{owner}/{repo}" try: response = requests.get(api_url) respo...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/homepage.py
scripts/homepage.py
#!/usr/bin/env python3 import argparse import json import os import sys import time from datetime import datetime import requests import yaml from dotenv import load_dotenv from google.cloud import bigquery from google.oauth2 import service_account TOKENS_PER_WEEK = "15B" # Badge tooltip texts GITHUB_STARS_TOOLTIP ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/__init__.py
scripts/__init__.py
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/history_prompts.py
scripts/history_prompts.py
history_prompt = """ Update the history markdown doc with changes shown in the diffs. Succinctly describe actual user-facing changes, not every single commit or detail that was made implementing them. Only add new items not already listed in the history markdown. Do NOT edit or update existing history entries. Do NOT ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/dl_icons.py
scripts/dl_icons.py
#!/usr/bin/env python3 """ Download Material Design Icons SVGs used in the README and save to local assets. """ from pathlib import Path import requests # Create the directory if it doesn't exist ICONS_DIR = Path("aider/website/assets/icons") ICONS_DIR.mkdir(parents=True, exist_ok=True) # Icons used in the README.m...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/recording_audio.py
scripts/recording_audio.py
#!/usr/bin/env python3 """ Generate TTS audio files for recording commentary using OpenAI's API. Usage: python scripts/recording_audio.py path/to/recording.md """ import argparse import json import os import re import subprocess import tempfile from pathlib import Path import requests from dotenv import load_dotenv ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/30k-image.py
scripts/30k-image.py
#!/usr/bin/env python # flake8: noqa: E501 """ Generate a celebratory SVG image for Aider reaching 30,000 GitHub stars. This creates a shareable social media graphic with confetti animation. """ import argparse import base64 import math import random from pathlib import Path # Default colors for the celebration image...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/blame.py
scripts/blame.py
#!/usr/bin/env python3 import argparse import os import subprocess import sys from collections import defaultdict from datetime import datetime from operator import itemgetter import semver import yaml from tqdm import tqdm website_files = [ "aider/website/index.html", "aider/website/share/index.md", "ai...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/update-history.py
scripts/update-history.py
#!/usr/bin/env python3 import os import re import subprocess import sys import tempfile from history_prompts import history_prompt def get_latest_version_from_history(): with open("HISTORY.md", "r") as f: history_content = f.read() # Find most recent version header match = re.search(r"### Aider...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/logo_svg.py
scripts/logo_svg.py
#!/usr/bin/env python3 """ Script to generate an SVG logo for Aider with embedded font. Reads the Glass_TTY_VT220.ttf font, subsets it to only include the letters needed, and creates an SVG with the word "aider" in terminal green (#14b014) on a transparent background. """ import argparse import base64 import os import...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/scripts/issues.py
scripts/issues.py
#!/usr/bin/env python3 import argparse import os import re from collections import defaultdict from datetime import datetime import requests from dotenv import load_dotenv from tqdm import tqdm def has_been_reopened(issue_number): timeline_url = f"{GITHUB_API_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues/{issue_nu...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/prompts.py
aider/prompts.py
# flake8: noqa: E501 # COMMIT # Conventional Commits text adapted from: # https://www.conventionalcommits.org/en/v1.0.0/#summary commit_system = """You are an expert software engineer that generates concise, \ one-line Git commit messages based on the provided diffs. Review the provided context and diffs which are a...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/help_pats.py
aider/help_pats.py
# This needs to sync with MANIFEST.in exclude_website_pats = [ "**/.DS_Store", "examples/**", "_posts/**", "HISTORY.md", "docs/benchmarks*md", "docs/ctags.md", "docs/unified-diffs.md", "docs/leaderboards/index.md", "assets/**", ".jekyll-metadata", "Gemfile.lock", "Gemfil...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/voice.py
aider/voice.py
import math import os import queue import tempfile import time import warnings from prompt_toolkit.shortcuts import prompt from aider.llm import litellm from .dump import dump # noqa: F401 warnings.filterwarnings( "ignore", message="Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work" ) war...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/report.py
aider/report.py
import os import platform import subprocess import sys import traceback import urllib.parse import webbrowser from aider import __version__ from aider.urls import github_issues from aider.versioncheck import VERSION_CHECK_FNAME FENCE = "`" * 3 def get_python_info(): implementation = platform.python_implementati...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/watch_prompts.py
aider/watch_prompts.py
watch_code_prompt = """ I've written your instructions in comments in the code and marked them with "ai" You can see the "AI" comments shown below (marked with █). Find them in the code files I've shared with you, and follow their instructions. After completing those instructions, also be sure to remove all the "AI" c...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/deprecated.py
aider/deprecated.py
def add_deprecated_model_args(parser, group): """Add deprecated model shortcut arguments to the argparse parser.""" opus_model = "claude-3-opus-20240229" group.add_argument( "--opus", action="store_true", help=f"Use {opus_model} model for the main chat (deprecated, use --model)", ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/history.py
aider/history.py
import argparse from aider import models, prompts from aider.dump import dump # noqa: F401 class ChatSummary: def __init__(self, models=None, max_tokens=1024): if not models: raise ValueError("At least one model must be provided") self.models = models if isinstance(models, list) else...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false
Aider-AI/aider
https://github.com/Aider-AI/aider/blob/1354e0bfa4847c1a71b9eea7374847a786d81c1b/aider/scrape.py
aider/scrape.py
#!/usr/bin/env python import re import sys import pypandoc from aider import __version__, urls, utils from aider.dump import dump # noqa: F401 aider_user_agent = f"Aider/{__version__} +{urls.website}" # Playwright is nice because it has a simple way to install dependencies on most # platforms. def check_env(): ...
python
Apache-2.0
1354e0bfa4847c1a71b9eea7374847a786d81c1b
2026-01-04T14:40:53.305258Z
false