repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
facebookresearch/localrf | https://github.com/facebookresearch/localrf | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | localTensoRF/train.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:47.926616 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (c) 2022 Anpei Chen
import os
import warnings
import cv2
import numpy as np
import torch
from tqdm.auto import tqdm
warnings.filterwarnings("ignore", category=DeprecationWarning)
import json
import sys
import time
from torch.utils.tensorboard import S... |
facebookresearch/localrf | https://github.com/facebookresearch/localrf | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | scripts/run_flow.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:48.250588 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (c) 2020 Virginia Tech Vision and Learning Lab
import numpy as np
import sys
import os
import cv2
sys.path.append('.')
sys.path.append('RAFT/core')
from RAFT.core.raft import RAFT
from RAFT.core.utils.utils import InputPadder
from RAFT.core.utils import... |
facebookresearch/localrf | https://github.com/facebookresearch/localrf | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | localTensoRF/utils/ray_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:48.251246 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (c) 2022 Anpei Chen
import numpy as np
import torch
from kornia import create_meshgrid
from torch import searchsorted
def contract(x):
x_norm = torch.clamp(x.abs().amax(dim=-1, keepdim=True), 1e-6)
z = torch.where(x_norm <= 1, x, ((2 * x_norm - ... |
facebookresearch/localrf | https://github.com/facebookresearch/localrf | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | localTensoRF/utils/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:48.313040 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (c) 2022 Anpei Chen
import cv2
import numpy as np
import scipy.signal
import torch
import torchvision.transforms as T
from PIL import Image
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy.interpolate import UnivariateS... |
facebookresearch/localrf | https://github.com/facebookresearch/localrf | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | localTensoRF/opt.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:50.557315 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (c) 2022 Anpei Chen
import configargparse
def config_parser(cmd=None):
parser = configargparse.ArgumentParser()
parser.add_argument("--config", is_config_file=True, help="config file path")
parser.add_argument(
"--logdir", type=str, ... |
facebookresearch/localrf | https://github.com/facebookresearch/localrf | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | localTensoRF/renderer.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:55.289505 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (c) 2022 Anpei Chen
import os
from signal import Handlers
import cv2
import imageio
import numpy as np
import torch
from tqdm.auto import tqdm
from utils.utils import (compute_depth_loss, get_fwd_bwd_cam2cams, get_pred_flow, rgb_ssim, visualize_depth, ... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/evaluator/evaluator.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.222977 | import os
import asyncio
import pandas as pd
from typing import Iterable, Optional, Iterator, Union, Literal, List, Dict, Any
from tqdm import tqdm
import torch
import time
import datetime
from torch.utils.tensorboard.writer import SummaryWriter
import numpy as np
import json
import math
from swarm.graph import Graph
... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | datasets/gaia/format.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.227244 | import json
input_file = 'level_1_val.jsonl'
output_file = 'level_1_val.json'
data = []
with open(input_file, 'r') as file:
for line in file:
json_obj = json.loads(line)
data.append(json_obj)
with open(output_file, 'w') as file:
json.dump(data, file, indent=4)
|
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | datasets/gaia/utils/prefix_clean.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.241920 | import os
prefix = "2023_validation_"
files_and_dirs = os.listdir('.')
for name in files_and_dirs:
if os.path.isfile(name) and name.startswith(prefix):
new_name = name[len(prefix):]
os.rename(name, new_name)
print(f"Renamed '{name}' to '{new_name}'")
|
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/evaluator/datasets/mmlu_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.247123 | import glob
import pandas as pd
from typing import Union, List, Literal
import numpy as np
from experiments.evaluator.datasets.base_dataset import BaseDataset, SwarmInput
class MMLUDataset(BaseDataset):
def __init__(self,
split: Union[Literal['dev'], Literal['val'], Literal['test']],
) -> None:
... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/evaluator/accuracy.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.248272 |
class Accuracy:
def __init__(self):
self._num_correct = 0
self._num_total = 0
def update(self, predicted: str, target: str) -> None:
is_correct = predicted == target
self._num_correct += int(is_correct)
self._num_total += 1
def get(self) -> float:
retur... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/crosswords/train.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.251684 | import json
from tqdm import tqdm
import asyncio
import numpy as np
from copy import deepcopy
import pickle
import torch
import sys
import random
from swarm.environment.domain.crosswords.env import MiniCrosswordsEnv
from swarm.environment.agents.agent_registry import AgentRegistry
from swarm.graph.swarm import Swarm
f... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | datasets/gaia/utils/data_split.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.255619 | import json
input_file = '2023_validation_metadata.jsonl'
output_files = {
1: 'level_1_val.jsonl',
2: 'level_2_val.jsonl',
3: 'level_3_val.jsonl'
}
data_by_level = {1: [], 2: [], 3: []}
with open(input_file, 'r') as file:
for line in file:
data = json.loads(line)
level = data.get("Lev... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/evaluator/datasets/base_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.265577 | import pandas as pd
from typing import Dict, Any, Union, List
from collections.abc import Sequence
from abc import ABC, abstractmethod
SwarmInput = Dict[str, Any]
class BaseDataset(ABC, Sequence[Any]):
@staticmethod
@abstractmethod
def get_domain() -> str:
""" To be overriden. """
@abstract... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | datasets/MMLU/download.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.276200 | import os
import requests
import tarfile
def download():
this_file_path = os.path.split(__file__)[0]
tar_path = os.path.join(this_file_path, "data.tar")
if not os.path.exists(tar_path):
url = "https://people.eecs.berkeley.edu/~hendrycks/data.tar"
print(f"Downloading {url}")
r = re... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/crosswords/evaluate.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:57.278059 | import json
from tqdm import tqdm
import asyncio
import numpy as np
from copy import deepcopy
import pickle
import torch
import sys
import random
from swarm.environment.domain.crosswords.env import MiniCrosswordsEnv
from swarm.environment.agents.agent_registry import AgentRegistry
from swarm.graph.swarm import Swarm
f... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/run_humaneval.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:58.098443 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import yaml
import json
import time
import asyncio
from pathlib import Path
from swarm.environment.tools.reader.readers import JSONLReader, YAMLReader
from swarm.environment.agents.humaneval.code_react import CodeReact
from swarm.environment.tool... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/run_gaia.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:58.100567 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import yaml
import json
import time
import asyncio
from pathlib import Path
from swarm.graph.swarm import Swarm
from swarm.environment.tools.reader.readers import JSONReader, YAMLReader
from swarm.environment.agents.io import IO
from s... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/run_mmlu.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:58.101829 | import asyncio
from typing import Union, Literal, Optional
import argparse
from swarm.graph.swarm import Swarm
from swarm.environment.operations.final_decision import MergingStrategy
from experiments.evaluator.evaluator import Evaluator
from experiments.evaluator.datasets.mmlu_dataset import MMLUDataset
from datasets.... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | experiments/run_crosswords.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:58.102730 | import json
from tqdm import tqdm
import asyncio
import numpy as np
from copy import deepcopy
import pickle
import torch
import sys
import random
from swarm.environment.domain.crosswords.env import MiniCrosswordsEnv
from swarm.environment.agents.agent_registry import AgentRegistry
from swarm.graph.swarm import Swarm
f... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/agent_registry.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:58.264499 | from typing import Type
from class_registry import ClassRegistry
from swarm.graph.graph import Graph
class AgentRegistry:
registry = ClassRegistry()
@classmethod
def register(cls, *args, **kwargs):
return cls.registry.register(*args, **kwargs)
@classmethod
def keys(cls):
ret... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/adversarial_agent.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.189581 | from swarm.graph import Graph
from swarm.environment.operations.adversarial_answer import AdversarialAnswer
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('AdversarialAgent')
class AdversarialAgent(Graph):
def build_graph(self):
adversarial_answer = Adversarial... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/cot.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.190803 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations.cot_step import CoTStep
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('COT')
class COT(Graph):
def build_graph(self):
num_thoughts = 3
asser... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.328364 | from swarm.environment.agents.io import IO
from swarm.environment.agents.tot import TOT
from swarm.environment.agents.cot import COT
from swarm.environment.agents.adversarial_agent import AdversarialAgent
from swarm.environment.agents.agent_registry import AgentRegistry
from swarm.environment.agents.crosswords.tot impo... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.362605 | from swarm.environment.tools.reader.readers import GeneralReader
from swarm.environment.tools.search.search import GoogleSearchEngine, SearchAPIEngine, BingSearchEngine,BoChaSearchEngine
__all__ = [
"GeneralReader",
"GoogleSearchEngine",
"SearchAPIEngine",
"BingSearchEngine",
"BoChaSearchEngine"
] |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/gaia/normal_io.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.700587 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations import DirectAnswer
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('NormalIO')
class NormalIO(Graph):
def build_graph(self):
io = DirectAnswer(self.doma... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/crosswords/reflection.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.710306 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
from swarm.graph import Graph
from swarm.environment.operations.crosswords import Reflection, GreedySteps
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('CrosswordsReflection')
class CrosswordsReflec... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/crosswords/brute_force_opt.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.769537 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
from swarm.graph import Graph
from swarm.environment.operations.crosswords import BruteForceStep
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('CrosswordsBruteForceOpt')
class CrosswordsBruteForceOp... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/gaia/tool_io.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.771111 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations import FileAnalyse, GenerateQuery, CombineAnswer
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('ToolIO')
class ToolIO(Graph):
def build_graph(self):
qu... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/gaia/web_io.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.772571 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations import WebSearch, GenerateQuery, CombineAnswer
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('WebIO')
class WebIO(Graph):
def build_graph(self):
query ... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/humaneval/code_io.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.812707 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations import CodeWriting
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('CodeIO')
class CodeIO(Graph):
def build_graph(self):
io = CodeWriting(self.domain, se... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/crosswords/tot.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.840860 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
from swarm.graph import Graph
from swarm.environment.operations.crosswords import BranchingStep, ReturnAll
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('CrosswordsToT')
class CrosswordsToT(Graph):
... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/humaneval/code_react.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.925467 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
from swarm.graph import Graph
from swarm.environment.operations import CodeWriting
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('CodeReact')
class CodeReact(Graph):
def __init__(self, domain: s... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/io.py | null | null | null | null | null | null | Python | 2026-05-04T01:31:59.943868 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations import DirectAnswer
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('IO')
class IO(Graph):
def build_graph(self):
io = DirectAnswer(self.domain, self.mod... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/domain/crosswords/env.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:00.557985 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# modified based on https://github.com/princeton-nlp/tree-of-thought-llm/blob/ab400345c5ea39d28ea6d7d3be0e417b11113c87/src/tot/tasks/crosswords.py
import pdb
import os
import json
import re
import random
import asyncio
class MiniCrosswordsEnv:
def __init__(self, file):... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/tot.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:00.590790 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations import GenerateQuery, FileAnalyse, WebSearch, CombineAnswer
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('TOT')
class TOT(Graph):
def build_graph(self):
... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:00.867851 | from swarm.environment.operations.combine_answer import CombineAnswer
from swarm.environment.operations.generate_query import GenerateQuery
from swarm.environment.operations.direct_answer import DirectAnswer
from swarm.environment.operations.file_analyse import FileAnalyse
from swarm.environment.operations.web_search i... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/adversarial_answer.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:01.164237 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
from collections import defaultdict
from typing import List, Any, Optional
from swarm.llm.format import Message
from swarm.graph import Node
from swarm.memory.memory import GlobalMemory
from swarm.utils.log import logger, swarmlog
from swarm.util... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/combine_answer.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:01.229716 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
from collections import defaultdict
from typing import List, Any, Optional
from swarm.llm.format import Message
from swarm.graph import Node
from swarm.environment.prompt.prompt_set_registry import PromptSetRegistry
from swarm.llm import LLMRegis... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/domain/crosswords/evaluator.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:01.401184 | from copy import deepcopy
import numpy as np
import random
from swarm.environment.domain.crosswords.env import MiniCrosswordsEnv
class CrosswordsEvaluator():
def __init__(self, data, batch_size=4, metric="words", window_size=10, init_socre=.5, use_init_score=False):
self.env = MiniCrosswordsEnv(data)
... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/cot_step.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:01.438079 | from swarm.llm.format import Message
from swarm.graph import Node
from typing import List, Any, Optional
from swarm.environment.prompt.prompt_set_registry import PromptSetRegistry
from swarm.llm.format import Message
from swarm.llm import LLMRegistry
class CoTStep(Node):
def __init__(self,
doma... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/domain/gaia/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:01.439284 | from swarm.environment.domain.gaia.evaluation.scorer import question_scorer
__all__ = [
"question_scorer"
] |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/domain/crosswords/parser.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:01.473540 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# modified based on https://github.com/princeton-nlp/tree-of-thought-llm/blob/ab400345c5ea39d28ea6d7d3be0e417b11113c87/scripts/crosswords/search_crosswords-dfs.ipynb
import re
def parse_response(response):
def parse_line(input_str):
# regular expression patter... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/domain/gaia/evaluation/app.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:01.536189 | import os
import json
import datetime
from email.utils import parseaddr
import gradio as gr
import pandas as pd
import numpy as np
from datasets import load_dataset
from apscheduler.schedulers.background import BackgroundScheduler
from huggingface_hub import HfApi
# InfoStrings
from scorer import question_scorer
fro... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/crosswords/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:02.012946 | from swarm.environment.operations.crosswords.branching_step import BranchingStep
from swarm.environment.operations.crosswords.return_all import ReturnAll
from swarm.environment.operations.crosswords.greedy_steps import GreedySteps
from swarm.environment.operations.crosswords.reflection import Reflection
from swarm.envi... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/crosswords/branching_step.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:02.215071 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
import asyncio
from typing import List, Any, Optional
from swarm.environment.prompt.prompt_set_registry import PromptSetRegistry
from swarm.environment.domain.crosswords.parser import parse_response
from swarm.llm import LLMRegistry
from swarm.en... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/crosswords/greedy_steps.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:02.315869 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
from typing import List, Any, Optional
from swarm.environment.prompt.prompt_set_registry import PromptSetRegistry
from swarm.environment.domain.crosswords.parser import parse_response
from swarm.llm import LLMRegistry
from swarm.environment.opera... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/direct_answer.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:02.566652 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
from collections import defaultdict
from swarm.llm.format import Message
from swarm.graph import Node
from swarm.memory.memory import GlobalMemory
from typing import List, Any, Optional
from swarm.utils.log import logger, swarmlog
from swarm.utils... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/crosswords/crosswords_operation.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:03.330661 |
from swarm.graph import Node
from swarm.llm.format import Message
class CrosswordsOperation(Node):
async def llm_query_with_cache(self, prompt):
cache = self.memory.query_by_id("cache")
if len(cache) == 0:
cache = {}
self.memory.add("cache", cache)
else:
... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/crosswords/brute_force_step.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:03.331835 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
from typing import List, Any, Optional
from swarm.environment.prompt.prompt_set_registry import PromptSetRegistry
from swarm.environment.domain.crosswords.parser import parse_response
from swarm.llm import LLMRegistry
from swarm.environment.opera... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/agents/gaia/tool_tot.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:03.970814 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from swarm.graph import Graph
from swarm.environment.operations import GenerateQuery, FileAnalyse, WebSearch, CombineAnswer
from swarm.environment.agents.agent_registry import AgentRegistry
@AgentRegistry.register('ToolTOT')
class ToolTOT(Graph):
def build_graph(self)... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/domain/gaia/evaluation/content.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:05.435741 | TITLE = """<h1 align="center" id="space-title">GAIA Leaderboard</h1>"""
INTRODUCTION_TEXT = """
GAIA is a benchmark which aims at evaluating next-generation LLMs (LLMs with augmented capabilities due to added tooling, efficient prompting, access to search, etc). (See our [paper](https://arxiv.org/abs/2311.12983) for m... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/domain/gaia/evaluation/scorer.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:05.514679 | import json
import re
import string
import warnings
import numpy as np
def normalize_number_str(number_str: str) -> float:
# we replace these common units and commas to allow
# conversion to float
for char in ["$", "%", ","]:
number_str = number_str.replace(char, "")
try:
return float... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/crosswords/reflection.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:07.176314 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
from typing import List, Any, Dict, Optional
from swarm.environment.prompt.prompt_set_registry import PromptSetRegistry
from swarm.environment.operations.crosswords.crosswords_operation import CrosswordsOperation
from swarm.environment.domain.cro... |
metauto-ai/GPTSwarm | https://github.com/metauto-ai/GPTSwarm | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | swarm/environment/operations/crosswords/return_all.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:07.233449 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import List, Any, Optional
import asyncio
from swarm.environment.prompt.prompt_set_registry import PromptSetRegistry
from swarm.llm import LLMRegistry
from swarm.environment.operations.crosswords.crosswords_operation import CrosswordsOperation
from swarm.envir... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/benchmark/run.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.412665 | import asyncio
from openai import AsyncOpenAI, OpenAI
from rich import print
from sparrow import MeasureTime, yaml_load # pip install sparrow-python
config = yaml_load("config.yaml", rel_path=True)
print(f"{config=}")
client = AsyncOpenAI(
api_key=config['api_key'],
base_url=config['api_base'],
... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/beta.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.413762 | from openai import OpenAI
from sparrow import yaml_load
config = yaml_load("config.yaml", rel_path=True)
print(f"{config=}")
client = OpenAI(
api_key=config['api_key'],
base_url=config['api_base'],
)
my_assistant = client.beta.assistants.create(
instructions="You are a personal math tutor. Wh... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/tts.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.416807 | from openai import OpenAI
from sparrow import relp, yaml_load
config = yaml_load("config.yaml")
client = OpenAI(
base_url=config["api_base"],
api_key=config["api_key"],
)
speech_file_path = relp("./speech.mp3")
response = client.audio.speech.create(
model="tts-1",
voice="alloy",
inp... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/tool_calls.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.417330 | from openai import OpenAI
from rich import print
from sparrow import MeasureTime, yaml_load # pip install sparrow-python
config = yaml_load("config.yaml", rel_path=True)
print(f"{config=}")
client = OpenAI(
api_key=config['api_key'],
base_url=config['api_base'],
)
stream = True
n = 1
# debug... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/gemini_pro.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.419310 | import requests
from rich import print
from sparrow import yaml_load # pip install sparrow-python
from openai_forward.helper import urljoin
config = yaml_load("config.yaml", rel_path=True)
print(f"{config=}")
route = "/v1/models/gemini-pro:generateContent"
url = urljoin(config['api_base'], route)
# url = "https:/... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/whisper.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.420869 | from openai import OpenAI
from sparrow import relp, yaml_load
config = yaml_load("config.yaml")
client = OpenAI(
base_url=config["api_base"],
api_key=config["api_key"],
)
audio_file = open("/path/to/audio.mp3", "rb")
transcript = client.audio.transcriptions.create(model="whisper-1", file=audio_fil... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/completion.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.422291 | import openai
from rich import print
from rich.console import Console
from rich.markdown import Markdown
from sparrow import yaml_load # pip install sparrow-python
config = yaml_load("config.yaml", rel_path=True)
print(f"{config=}")
openai.api_base = config["api_base"]
openai.api_key = config["api_key"]
... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.423706 | from openai import OpenAI
from openai._types import Headers, Query
from rich import print
from sparrow import MeasureTime, yaml_load # pip install sparrow-python
config = yaml_load("config.yaml", rel_path=True)
print(f"{config=}")
client = OpenAI(
api_key=config['api_key'],
base_url=config['api_bas... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/embedding.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.425652 | from openai import OpenAI
from sparrow import yaml_load
config = yaml_load("config.yaml")
client = OpenAI(
api_key=config['api_key'],
base_url=config['api_base'],
)
response = client.embeddings.create(
model="text-embedding-ada-002",
input="你好",
encoding_format="float",
# encoding... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | Examples/chat_completion.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:09.426822 | from openai import OpenAI
from rich import print
from sparrow import MeasureTime, yaml_load # pip install sparrow-python
config = yaml_load("config.yaml", rel_path=True)
print(f"{config=}")
client = OpenAI(
api_key=config['api_key'],
base_url=config['api_base'],
)
stream = True
n = 1
debug... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/__main__.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:11.448423 | import atexit
import datetime
import os
import pickle
import platform
import signal
import subprocess
from pathlib import Path
import fire
import uvicorn
import yaml
def save_yaml(path: Path, data: dict):
with open(path, 'w') as f:
yaml.dump(data, f)
class Cli:
def run_web(self, port=8001, openai_f... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/cache/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:11.452290 | from flaxkv.pack import encode
from loguru import logger
from openai_forward.config.settings import (
CACHE_OPENAI,
CACHE_ROUTE_SET,
CHAT_COMPLETION_ROUTE,
EMBEDDING_ROUTE,
)
from .chat.response import gen_response, get_cached_chat_response
from .database import db_dict
from .embedding.res... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/app.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:11.453811 | from contextlib import asynccontextmanager
from fastapi import FastAPI, Request, status
from fastapi.middleware.cors import CORSMiddleware
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from . import __version__
from .config.settings import (
BENCHM... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/cache/database.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:11.454777 | from flaxkv import FlaxKV
from ..config.settings import CACHE_BACKEND, CACHE_ROOT_PATH_OR_URL, LOG_CACHE_DB_INFO
if CACHE_BACKEND.upper() == "MEMORY":
db_dict = {}
elif CACHE_BACKEND.lower() in ("leveldb", "lmdb"):
log, save_log = ("INFO", True) if LOG_CACHE_DB_INFO else (None, False)
db_dic... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/cache/chat/response.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:11.456060 | from __future__ import annotations
import random
from typing import List
from fastapi.responses import Response, StreamingResponse
from flaxkv.pack import encode
from loguru import logger
from openai_forward.config.settings import CACHE_OPENAI, FWD_KEY
from ..database import db_dict
from .chat_completio... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/cache/chat/chat_completions.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:11.457955 | from __future__ import annotations
import time
from itertools import cycle
from typing import List, Literal, Optional, Union
import attrs
import orjson
from fastapi import Request
from fastapi.responses import Response, StreamingResponse
from openai_forward.config.settings import FWD_KEY, token_interval_c... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/cache/chat/tokenizer.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:11.458970 | try:
import tiktoken
TIKTOKEN_VALID = True
except ImportError:
print("Warning: `tiktoken` not found. Install with `pip install tiktoken`.")
TIKTOKEN_VALID = False
def encode_as_pieces(sentence):
words = []
delimiters = {':', '。', ',', '、', '!', '?', ':', '.', ',', '!', '?'}
... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/content/config.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.494893 | import functools
import logging
import os
import sys
import time
from datetime import datetime
import pytz
from loguru import logger
from ..helper import route_prefix_to_str
class InterceptHandler(logging.Handler):
def emit(self, record):
# Get corresponding Loguru level if it exists
... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/console.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.509051 | from typing import List
from rich import print
from rich.panel import Panel
from rich.table import Table
from . import __version__
def print_startup_info(base_url, route_prefix, api_key, fwd_key, /, style, **kwargs):
"""
Prints the startup information of the application.
"""
try:
from dotenv... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/custom_slowapi.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.509639 | import inspect
from typing import List
from slowapi.extension import Limit, LimitGroup, RateLimitItem
from slowapi.wrappers import parse_many
def __iter__(self):
if callable(self._LimitGroup__limit_provider):
if (
"key"
in inspect.signature(self._LimitGroup__limit_provi... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/config/interface.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.514659 | import json
from typing import Literal
from attrs import asdict, define, field
from openai_forward.config.settings import *
class Base:
def to_dict(self, drop_none=True):
if drop_none:
def custom_filter(attribute, value):
if drop_none:
retur... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/config/settings.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.517689 | import itertools
import os
from pathlib import Path
from typing import Any, Dict, List, Set
import limits
import yaml
from fastapi import Request
from openai_forward.console import print_rate_limit_info, print_startup_info
from openai_forward.content.config import setting_log
from openai_forward.helper import format_... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/content/openai.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.519185 | import os
import threading
import time
from abc import ABC, abstractmethod
from typing import Dict, List, Tuple
import orjson
from fastapi import Request
from loguru import logger
from orjson import JSONDecodeError
from openai_forward.config.settings import DEFAULT_REQUEST_CACHING_VALUE
from ..helper im... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/content/helper.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.531212 | from typing import List
from rich.console import Console, Text
RoleColor = {
"system": "#ea4335",
"user": "#F5A88E",
"assistant": "#BDADFF",
"function": "#f79393",
"preprompt": "#f7d97f",
"other": "#4285f4",
}
# ----------- console tools ------------
console = Console()
... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/cache/embedding/response.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:13.620578 | from __future__ import annotations
from fastapi.responses import Response
from flaxkv.pack import encode
from loguru import logger
from ...config.settings import CACHE_OPENAI
from ..database import db_dict
def construct_cache_key(payload_info):
elements = [
payload_info['model'],
pa... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/forward/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:15.019186 | from typing import List
from openai_forward.config.settings import (
GENERAL_BASE_URL,
GENERAL_ROUTE_PREFIX,
OPENAI_BASE_URL,
OPENAI_ROUTE_PREFIX,
PROXY,
)
from .core import GenericForward, OpenaiForward
class ForwardManager:
def __init__(self):
"""
Initializes the class by c... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/webui/helper.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:15.020218 | import streamlit as st
from streamlit.components.v1 import components
def mermaid(code: str) -> None:
st.components.v1.html(
f"""
<pre class="mermaid">
{code}
</pre>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/np... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/decorators.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:15.022790 | import asyncio
import inspect
import random
import time
from functools import wraps
from typing import Callable
from fastapi import Request
from loguru import logger
def retry(max_retries=3, delay=1, backoff=2, exceptions=(Exception,)):
"""
A decorator for automatically retrying a function upon encountering ... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | scripts/keep_render_alive.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:15.023778 | from urllib.parse import urljoin
import httpx
import schedule
def job(url: str = "https://render.openai-forward.com"):
health_url = urljoin(url, "/healthz")
try:
r = httpx.get(health_url, timeout=5)
result = r.json()
print(result)
assert result == "OK"
except Exception as ... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/webui/run.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:15.025167 | import ast
import os
import pickle
import secrets
import threading
import orjson
import pandas as pd
import streamlit as st
import zmq
from flaxkv.helper import SimpleQueue
from openai_forward.config.interface import *
from openai_forward.webui.chat import ChatData
from openai_forward.webui.helper impor... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/forward/core.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:15.025742 | from __future__ import annotations
import asyncio
import traceback
from asyncio import Queue
from itertools import cycle
from typing import AsyncGenerator
import aiohttp
import anyio
import litellm
import orjson
from aiohttp import TCPConnector
from fastapi import HTTPException, Request, status
from log... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/webui/chat.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:16.114816 | from collections import OrderedDict, deque
from typing import Callable, Dict
import streamlit as st
def render_chat_log_message(msg: Dict, markdown=True):
msg = msg.copy()
render = st.markdown if markdown else st.text
if msg.get("user_role"):
messages = msg.pop('messages')
with st.chat_me... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | openai_forward/helper.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:16.424076 | import ast
import hashlib
import inspect
import os
import re
import time
from pathlib import Path
from typing import Dict, List, Union
import orjson
from fastapi import Request
from rich import print
class InfiniteSet:
def __contains__(self, item):
return True
def get_inner_ip():
import socket
... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | tests/test_settings.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:16.713942 | from openai_forward.config.settings import (
CACHE_ROUTE_SET,
FORWARD_CONFIG,
FWD_KEY,
ITER_CHUNK_TYPE,
LEVEL_MODELS,
OPENAI_API_KEY,
TIMEOUT,
)
def test_timeout():
assert isinstance(TIMEOUT, float)
def test_iter_chunk_type():
assert ITER_CHUNK_TYPE in ["efficiency", "one-by-one"... |
KenyonY/openai-forward | https://github.com/KenyonY/openai-forward | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | tests/test_forwarding.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:16.798482 | import importlib
from unittest.mock import Mock
import pytest
from fastapi import Request
from openai_forward.forward.core import GenericForward
@pytest.fixture(
params=[
{
"FWD_KEY": {'fk0': 0, 'fk1': 1, 'fk2': 2},
# "FWD_KEY": {0:["fk-0"], 1:["fk-1"], 2: ["fk-2"]},... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/auth/view.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:19.882658 | from typing import Any, List
from sqlalchemy.orm import Session
from starlette.requests import Request
from starlette_admin import action
from starlette_admin.contrib.sqla import ModelView
from .model import Article, Status
class ArticleView(ModelView):
exclude_fields_from_list = [Article.body]
def can_vie... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/authlib/app.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:19.883745 | from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
String,
Text,
create_engine,
)
from sqlalchemy.orm import declarative_base, relationship
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.middleware.sessions import SessionM... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/auth/app.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:19.994652 | import os
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.middleware.sessions import SessionMiddleware
from starlette.responses import HTMLResponse
from starlette.routing import Mount, Route
from starlette.staticfiles import StaticFiles
from starlette_admin.contr... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/authlib/config.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:19.996138 | import os
DATABASE_FILE = "sample_db.sqlite"
ENGINE_URI = "sqlite:///" + DATABASE_FILE
SECRET = "1234567890"
AUTH0_CLIENT_ID = os.getenv("AUTH0_CLIENT_ID", "your-auth0-client-id")
AUTH0_CLIENT_SECRET = os.getenv("AUTH0_CLIENT_SECRET", "your-auth0-client-secret")
AUTH0_DOMAIN = os.getenv("AUTH0_DOMAIN", "your-auth0-do... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/auth/model.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:20.075125 | import enum
from sqlalchemy import Column, Enum, Integer, String, Text
from . import Base
class Status(str, enum.Enum):
Draft = "d"
Published = "p"
Withdrawn = "w"
class Article(Base):
__tablename__ = "article"
id = Column(Integer, primary_key=True)
title = Column(String(100), nullable=Fa... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/auth/seed.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:20.126627 | import random
from sqlalchemy.orm import Session
from . import engine
from .model import Article, Status
fixture = [
{
"title": "His mother had always taught him",
"body": "His mother had always taught him not to ever think of himself as better than others. He'd tried to live by this motto. He ne... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/authlib/provider.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:20.486414 | from typing import Optional
from starlette.datastructures import URL
from starlette.requests import Request
from starlette.responses import RedirectResponse, Response
from starlette.routing import Route
from starlette_admin import BaseAdmin
from starlette_admin.auth import (
AdminUser,
AuthProvider,
login_... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/beanie/app.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:20.554626 | from starlette.applications import Starlette
from starlette.responses import HTMLResponse
from starlette.routing import Route
from starlette_admin.contrib.beanie import Admin, ModelView
from .dependencies import create_db_and_tables
admin = Admin()
async def setup_db():
models = await create_db_and_tables()
... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/babel/app.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:20.557832 | from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
String,
Text,
create_engine,
)
from sqlalchemy.orm import declarative_base, relationship
from starlette.applications import Starlette
from starlette.responses import HTMLResponse
from starlette.routing import Route
from starlett... |
jowilf/starlette-admin | https://github.com/jowilf/starlette-admin | null | null | null | null | 988 | null | null | mit | null | null | null | null | null | null | null | examples/auth/provider.py | null | null | null | null | null | null | Python | 2026-05-04T01:32:20.598939 | from starlette.requests import Request
from starlette.responses import Response
from starlette_admin.auth import AdminConfig, AdminUser, AuthProvider
from starlette_admin.exceptions import FormValidationError, LoginFailed
users = {
"admin": {
"name": "Administrator",
"avatar": "avatar.png",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.