text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
#!/usr/bin/env python3 """ 存储后端数据迁移脚本 用法: python scripts/migrate_storage.py --from json --to postgres python scripts/migrate_storage.py --from postgres --to git python scripts/migrate_storage.py --export accounts.json python scripts/migrate_storage.py --import accounts.json """ import argparse import json imp...
pocongtobat008/ai-hub-gateway
scripts/migrate_storage.py
.py
9e9b284b116c3cf4
7
0
"""Bansos provider — connects to bansos-router daemon for free keyless models.""" from __future__ import annotations import json import logging import time import uuid import threading from typing import Any, Iterator import httpx logger = logging.getLogger(__name__) REQUEST_TIMEOUT = 60.0 # Free models seeded fro...
pocongtobat008/ai-hub-gateway
services/bansos_provider.py
.py
8459771a311f7942
7
0
from __future__ import annotations import re from curl_cffi import requests from fastapi import HTTPException from services.config import config from services.proxy_service import proxy_settings from utils.log import logger DEFAULT_REVIEW_PROMPT = "判断用户请求是否允许。只回答 ALLOW 或 REJECT。" # Strip base64 image data URIs bef...
pocongtobat008/ai-hub-gateway
services/content_filter.py
.py
d172fda57c492421
7
0
"""Custom provider — round-robin OpenAI-compatible API with model validation.""" from __future__ import annotations import json import logging import time import uuid import threading from typing import Any, Iterator import httpx from services.custom_account_service import ( get_all_endpoints, get_credential...
pocongtobat008/ai-hub-gateway
services/custom_provider.py
.py
03f9818e6e494650
7
0
"""In-memory conversation memory for session-based chat continuity.""" from __future__ import annotations import threading import time from dataclasses import dataclass, field @dataclass class ChatMessage: role: str # "user" or "assistant" content: str timestamp: float = field(default_factory=t...
Aadhithya-balu/Saksha_Datathon
backend/app/ai/chat/memory.py
.py
0d19abe2cd838925
7.35
4
"""Vector retrieval augmentation for the AI chat pipeline (issue #122). Bridges the database-grounded RAG stack (`build_rag_documents` + in-memory vector store) into `ChatOrchestrator`, so free-text questions recall relevant FIRs, criminals, evidence, and cases even when intent routing has no exact structured match. S...
Aadhithya-balu/Saksha_Datathon
backend/app/ai/chat/rag_retriever.py
.py
69315abace920f26
7.35
4
from __future__ import annotations from dataclasses import dataclass from typing import Any import numpy as np @dataclass(frozen=True) class AnomalyFeatureVector: feature_names: list[str] values: np.ndarray def build_anomaly_features(event: dict[str, Any]) -> AnomalyFeatureVector: """Create a fixed-si...
Aadhithya-balu/Saksha_Datathon
backend/app/ai/features/anomaly/feature_engineering.py
.py
3f93aff7d9cb9dda
7.35
4
from __future__ import annotations from dataclasses import dataclass import json from pathlib import Path from typing import Any import numpy as np @dataclass(frozen=True) class AnomalyExplanation: top_features: list[dict[str, Any]] score: float threshold: float is_anomaly: bool @dataclass(frozen=...
Aadhithya-balu/Saksha_Datathon
backend/app/ai/models/anomaly/model.py
.py
6ba59814ca769115
7.35
4
""" SAKSHA – Hotspot Prediction Evaluation Responsibilities ---------------- - RMSE, MAE, R² - Feature importance (gain) - SHAP values summary - Returns structured evaluation report dict No training. No inference. No FastAPI. """ from __future__ import annotations import logging from typing import Any import numpy...
Aadhithya-balu/Saksha_Datathon
backend/app/ai/pipelines/hotspot/evaluate.py
.py
90b9d59d2e16b1ed
7.35
4
""" SAKSHA – Hotspot Model Artifact Serialization Responsibilities ---------------- - joblib serialization of trained model - feature_columns.json - model_metadata.json (includes training_rows, rmse, mae, r2) - training_metrics.json No training. No inference. No FastAPI. """ from __future__ import annotations impo...
Aadhithya-balu/Saksha_Datathon
backend/app/ai/pipelines/hotspot/save_model.py
.py
bcb6c2774bb8788e
7.35
4
""" SAKSHA – Risk & Forecast Model Evaluation Shared evaluation utilities for both DistrictRiskModel and DistrictForecastModel. No training. No inference. No FastAPI. """ from __future__ import annotations import logging from typing import Any import numpy as np from sklearn.metrics import mean_absolute_error, mean...
Aadhithya-balu/Saksha_Datathon
backend/app/ai/pipelines/risk/evaluate.py
.py
d3e6eb96497c1dbd
7.35
4
# community_data.py """ Community-driven data sharing for Green Agent. Users can optionally contribute anonymized data to improve simulations. """ import json from pathlib import Path from datetime import datetime class CommunityDataHub: """ Optional community data sharing. Users can choose to cont...
NurcholishAdam/Green_Agent
community_data.py
.py
00edfe4289d9adfe
7.15
1
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Demo: Neuro-Symbolic Oversight for Green Agent Demonstrates the symbolic reasoning engine with formal rule evaluation and violation trace generation. """ import json from src.symbolic.symbolic_reasoning_engine import SymbolicReasoningEngine from src.dashboard.symboli...
NurcholishAdam/Green_Agent
demo_symbolic_oversight.py
.py
c84bf0f09d9669d1
7.15
1
""" docker_metrics_collector.py Collects runtime, memory, and CPU-based energy metrics from inside a Docker container for green benchmarking. """ import os import time import statistics from typing import Callable, Dict, List class DockerMetricsCollector: def __init__( self, carb...
NurcholishAdam/Green_Agent
docker_metrics_collector.py
.py
8809709c0c3b0f58
7.15
1
# File: quantum_integration/error_mitigation/quantum_error_mitigator.py import pennylane as qml from pennylane import numpy as np from typing import List, Dict, Tuple, Optional from dataclasses import dataclass from enum import Enum import numpy as np class ErrorType(Enum): DEPOLARIZING = "depolarizing" DEPHA...
NurcholishAdam/Green_Agent
quantum_integration/error_mitigation/quantum_error_mitigator.py
.py
931c525ff485d7f6
7.15
1
# File: quantum_integration/multi_agent/quantum_multi_agent_rl.py import asyncio from typing import Dict, List, Tuple from dataclasses import dataclass, field from enum import Enum import numpy as np import pennylane as qml class AgentRole(Enum): SCHEDULER = "scheduler" OPTIMIZER = "optimizer" MONITOR = "...
NurcholishAdam/Green_Agent
quantum_integration/multi_agent/quantum_multi_agent_rl.py
.py
2b9e2623607b2766
7.15
1
# -*- coding: utf-8 -*- """ AutoGen Agent Adapter Adapter for Microsoft AutoGen agents """ from typing import Dict, Any import logging from .base_adapter import BaseAgentAdapter logger = logging.getLogger(__name__) class AutoGenAdapter(BaseAgentAdapter): """ Adapter for Microsoft AutoGen agen...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/autogen_adapter.py
.py
ee78351bde59bbb6
7.15
1
""" Adapter implementation for AutoGen-style agents. Captures message graph depth and conversation complexity as part of metrics. """ from typing import Dict, Any from .base_runtime import BaseRuntimeAdapter import time class AutoGenRuntime(BaseRuntimeAdapter): def init(self, config: Dict[str, Any]) -> None: ...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/autogen_runtime.py
.py
79de6babf62f0be8
7.15
1
# -*- coding: utf-8 -*- """ Base Agent Adapter Abstract base class for framework-specific adapters """ from abc import ABC, abstractmethod from typing import Dict, Any, Optional import logging logger = logging.getLogger(__name__) class BaseAgentAdapter(ABC): """ Abstract base class for agent ...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/base_adapter.py
.py
9d971e91e6da615e
7.15
1
""" Base adapter for framework runtimes. Defines the interface that all runtime adapters must implement. """ from abc import ABC, abstractmethod from typing import Dict, Any class BaseRuntimeAdapter(ABC): @abstractmethod def init(self, config: Dict[str, Any]) -> None: """Initialize the runtime with co...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/base_runtime.py
.py
e090cf9e4617d161
7.15
1
# -*- coding: utf-8 -*- """ CrewAI Agent Adapter Adapter for CrewAI role-based agents """ from typing import Dict, Any import logging from .base_adapter import BaseAgentAdapter logger = logging.getLogger(__name__) class CrewAIAdapter(BaseAgentAdapter): """ Adapter for CrewAI agents. ...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/crewai_adapter.py
.py
a13805ccc6442be3
7.15
1
# -*- coding: utf-8 -*- """ LangChain Agent Adapter Adapter for LangChain/LangGraph agents """ from typing import Dict, Any import logging from .base_adapter import BaseAgentAdapter logger = logging.getLogger(__name__) class LangChainAdapter(BaseAgentAdapter): """ Adapter for LangChain and La...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/langchain_adapter.py
.py
cd615d648ddb9936
7.15
1
""" Adapter implementation for LangChain-based agents. Integrates LangChain execution into the multi-metric evaluation pipeline. """ from typing import Dict, Any from .base_runtime import BaseRuntimeAdapter import time class LangChainRuntime(BaseRuntimeAdapter): def init(self, config: Dict[str, Any]) -> None: ...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/langchain_runtime.py
.py
4254ba7682963039
7.15
1
# -*- coding: utf-8 -*- """ LIMIT-GRAPH Agent Adapter Adapter for native LIMIT-GRAPH quantum agents """ from typing import Dict, Any import logging from .base_adapter import BaseAgentAdapter logger = logging.getLogger(__name__) class LimitGraphAdapter(BaseAgentAdapter): """ Adapter for native...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/adapters/limit_graph_adapter.py
.py
7ac40fe1688855e9
7.15
1
# -*- coding: utf-8 -*- """ Feedback Integration & Audit Logger Tracks expert invocations, feedback integration, and sustainability metrics. Provides transparency reports for accountability. """ from typing import Dict, List, Any, Optional from dataclasses import dataclass, asdict from enum import Enum from datetime ...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/audit_layer/audit_logger.py
.py
eddd645e380a1e48
7.15
1
# -*- coding: utf-8 -*- """ Human-in-the-Loop Portal & Expert Collaboration System Integration Provides interface for human reviewers and integrates all expert collaboration components into a unified system. """ from typing import Dict, List, Any, Optional, Callable from dataclasses import dataclass, asdict from enum...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/audit_layer/expert_collaboration_system.py
.py
bf0baa5a167051dd
7.15
1
# -*- coding: utf-8 -*- """ A2A Protocol Gateway - AgentBeats Compliance Layer Validates and transforms agent I/O to A2A standard format """ from typing import Dict, Any, Optional, List from dataclasses import dataclass from enum import Enum import json from datetime import datetime class A2AVersion(Enu...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/core/a2a_gateway.py
.py
3e26a33f21ae3e41
7.15
1
# -*- coding: utf-8 -*- """ Agent Evaluator Unified evaluation framework for agents across different frameworks """ from typing import Dict, Any, List, Optional import logging from .agentbench_adapter import AgentBenchAdapter from .green_metrics import GreenMetricsTracker logger = logging.getLogger(__name_...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/core/agent_evaluator.py
.py
43f98bdab2dcd4e7
7.15
1
# -*- coding: utf-8 -*- """ AgentBench Protocol Adapter Provides standardized interface compatible with AgentBench protocol """ import json import hashlib from typing import Dict, Any, List, Optional from datetime import datetime import logging logger = logging.getLogger(__name__) class AgentBenchAda...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/core/agentbench_adapter.py
.py
75518969eefd03e7
7.15
1
# -*- coding: utf-8 -*- """ Benchmark Harness Orchestration engine for running comprehensive benchmarks """ import json from typing import Dict, Any, List, Optional from pathlib import Path import logging from datetime import datetime from .agent_evaluator import AgentEvaluator from .agentbench_adapter i...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/core/benchmark_harness.py
.py
938b69ad694a4a9c
7.15
1
# -*- coding: utf-8 -*- """ Docker Orchestrator - Independent Execution Manager Manages containerized agent execution for AgentBeats compliance """ import json import subprocess import time from typing import Dict, Any, Optional from pathlib import Path from dataclasses import dataclass @dataclass cla...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/core/docker_orchestrator.py
.py
b7251cc270b652e8
7.15
1
# Update src/core/green_metrics.py from analysis.complexity_analyzer import ComplexityAnalyzer from metrics.efficiency_calculator import NormalizedEfficiencyCalculator class GreenMetricsTracker: def __init__(self): self.complexity_analyzer = ComplexityAnalyzer() self.efficiency_calc = Norm...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/core/green_metrics.py
.py
e95ade394d8b428f
7.15
1
# -*- coding: utf-8 -*- """ RLHF Feedback Engine - Reasoning Trace Analysis Generates detailed feedback for agent improvement based on RLHF research """ from typing import Dict, Any, List, Optional, Tuple from dataclasses import dataclass from enum import Enum import json import re class ReasoningQualit...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/core/rlhf_feedback_engine.py
.py
c5319aa03af2bccb
7.15
1
# -*- coding: utf-8 -*- """ Carbon Dashboard Carbon footprint visualization (placeholder for future implementation) """ import logging logger = logging.getLogger(__name__) class CarbonDashboard: """ Carbon footprint dashboard. Placeholder for future visualization implementation. ...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/dashboard/carbon_dashboard.py
.py
856d9bef724d7b65
7.15
1
# -*- coding: utf-8 -*- """ Comparison Matrix Cross-framework comparison visualization (placeholder for future implementation) """ import logging logger = logging.getLogger(__name__) class ComparisonMatrix: """ Cross-framework comparison matrix. Placeholder for future visualization i...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/dashboard/comparison_matrix.py
.py
d200769b9fae2387
7.15
1
# -*- coding: utf-8 -*- """ Energy Visualizer Energy consumption visualization (placeholder for future implementation) """ import logging logger = logging.getLogger(__name__) class EnergyVisualizer: """ Energy consumption visualizer. Placeholder for future visualization implementatio...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/dashboard/energy_visualizer.py
.py
8f65f834c790339d
7.15
1
# -*- coding: utf-8 -*- """ Green Leaderboard Unified leaderboard with green metrics """ import json from typing import Dict, List, Any, Optional from pathlib import Path from datetime import datetime import logging logger = logging.getLogger(__name__) class GreenLeaderboard: """ Unified gr...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/dashboard/green_leaderboard.py
.py
6b732c80d7c4a75f
7.15
1
# -*- coding: utf-8 -*- """ AgentBeats Complete Integration Demo Demonstrates all four pillars: A2A Compliance, Independence, Robust Scoring, RLHF Feedback """ import time import json from typing import Dict, Any, Optional from pathlib import Path # Import AgentBeats components from core.a2a_gateway impor...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/demo_agentbeats_integration.py
.py
c5741d14bdebaa39
7.15
1
# -*- coding: utf-8 -*- """ Demo: Green Agent Benchmarking Demonstrates the LIMIT-AgentBench platform capabilities """ import sys import logging from typing import Dict, Any # Setup logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logg...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/demo_green_benchmark.py
.py
954188f737d0a811
7.15
1
""" docker_metrics_collector.py Collects runtime, memory, and CPU-based energy metrics from inside a Docker container for green benchmarking. """ import os import time import statistics from typing import Callable, Dict, List class DockerMetricsCollector: def __init__( self, carbon_intensity: fl...
NurcholishAdam/Green_Agent
quantum_integration/quantum-limit-graph-v2.4.0/limit-agentbench/docker_metrics_collector.py
.py
fef066f216af6e17
7.15
1
"""first Revision ID: b2437a6523e3 Revises: Create Date: 2022-10-28 09:35:00.424510 """ import sqlalchemy as sa from alembic import op from sqlalchemy import func # revision identifiers, used by Alembic. revision = "b2437a6523e3" down_revision = None branch_labels = None depends_on = None def _create_updated_at_t...
RaoSharifMansoob/fastapi-cicd-demo
app/database/migraions/versions/b2437a6523e3_first.py
.py
66d99635b885b5fe
7
0
from sqlalchemy.exc import DatabaseError from sqlalchemy.ext.asyncio import AsyncSession from app.utils import AppExceptionCase class BaseRepository: """Base Repository for all repositories.""" def __init__(self, conn: AsyncSession) -> None: self._conn = conn @property def connection(self) ...
RaoSharifMansoob/fastapi-cicd-demo
app/database/repositories/base.py
.py
80f6573cdbed6073
7
0
from fastapi import Request, status from fastapi.responses import JSONResponse from app.schemas.message import ErrorResponse ERROR_RESPONSES = { status.HTTP_400_BAD_REQUEST: { "model": ErrorResponse, "content": { "application/json": { "example": { "a...
RaoSharifMansoob/fastapi-cicd-demo
app/utils/app_exceptions.py
.py
f648886947c07a19
7
0
"""Stock-firmware BLE protocol for the Arcade Coder. Reverse engineering credit: the awesome-arcade-coder community and LightyCoderDoodad (github.com/diggedypomme/LightyCoderDoodad). """ from __future__ import annotations import struct import zlib SERVICE_UUID = "778d5426-fa29-4363-91fd-a9f5cfcfce85" COMMAND_CHAR =...
hansstam86/arcade-coder-games
arcadecoder/protocol.py
.py
ccffbb5fba47dda8
7
0
"""Backend-independent game loop shared by the emulator and BLE runners.""" from __future__ import annotations import time from . import Game, Screen class GameLoop: """Drives a Game: instantiate, tick, deliver presses, auto-restart.""" def __init__(self, game_cls: type[Game]) -> None: self.game_c...
hansstam86/arcade-coder-games
arcadecoder/runner.py
.py
8befa4c01381fd14
7
0
#!/usr/bin/env python3 """Diagnostic session against the Arcade Coder: services, testmode, known-good canvas.""" import asyncio import json import time from pathlib import Path from bleak import BleakClient from minesweeper import ( CALLBACK_CHAR, COMMAND_CHAR, SERVICE_UUID, cmd_paint_frame, cmd_s...
hansstam86/arcade-coder-games
debug_board.py
.py
d14424f54ab68733
7
0
#!/usr/bin/env python3 """Chase — the smallest possible arcadecoder game. A green target sits somewhere; press it to score and it jumps elsewhere. You have 15 seconds. Run with `python examples/chase.py` (emulator) or `python examples/chase.py --hw` (real board). """ import random from arcadecoder import Game, run ...
hansstam86/arcade-coder-games
docs/py/examples/chase.py
.py
32893ed5a9327445
7
0
#!/usr/bin/env python3 """Chase — the smallest possible arcadecoder game. A green target sits somewhere; press it to score and it jumps elsewhere. You have 15 seconds. Run with `python examples/chase.py` (emulator) or `python examples/chase.py --hw` (real board). """ import random import sys from pathlib import Path ...
hansstam86/arcade-coder-games
examples/chase.py
.py
d897daafada80917
7
0
"""experiments table Revision ID: 0002 Revises: 0001 Create Date: 2026-08-25 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql revision = "0002" down_revision = "0001" branch_labels = None depends_on = None def upgrade(): op.create_table( "experiments", ...
siddharthgaur1/openeval
backend/alembic/versions/0002_experiments.py
.py
f8a5f8498bcbcb2e
7
0
"""eval run row-level progress + failure tracking Revision ID: 0003 Revises: 0002 Create Date: 2026-08-25 """ import sqlalchemy as sa from alembic import op revision = "0003" down_revision = "0002" branch_labels = None depends_on = None def upgrade(): op.add_column("eval_runs", sa.Column("total_rows", sa.Integ...
siddharthgaur1/openeval
backend/alembic/versions/0003_eval_progress.py
.py
9518c0b866f6811b
7
0
"""webhooks table Revision ID: 0004 Revises: 0003 Create Date: 2026-08-25 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql revision = "0004" down_revision = "0003" branch_labels = None depends_on = None def upgrade(): op.create_table( "webhooks", sa....
siddharthgaur1/openeval
backend/alembic/versions/0004_webhooks.py
.py
42c74e47e55c4530
7
0
"""Scope traces/datasets/prompt_templates/eval_runs/experiments/webhooks to a project instead of directly to a user - the multi-tenancy retrofit. Adds project_id nullable, backfills a personal Organization + "default" Project for every existing user who doesn't already have one (matching services.organization_service....
siddharthgaur1/openeval
backend/alembic/versions/0008_project_scoping.py
.py
cefc283519454925
7
0
"""Add a scope column (read/write/admin) to api_keys and enforce it - previously every API key had unrestricted access regardless of what scope the caller requested at creation time (the field wasn't even stored). Existing keys backfill to "write" (their previous de-facto behavior minus admin-only actions), so this mi...
siddharthgaur1/openeval
backend/alembic/versions/0009_api_key_scope.py
.py
a44e62f334d491c1
7
0
from fastapi import Depends, HTTPException, Request, status from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from sqlalchemy.orm import Session from core.config import settings from core.database import get_db from core.security import decode_access_token, verify_api_key from models.user import AP...
siddharthgaur1/openeval
backend/api/deps.py
.py
cbf253a39d86ac7d
7
0
from fastapi import APIRouter, Depends from sqlalchemy.orm import Session from api.deps import get_current_user from core.database import get_db from models.organization import Membership from models.project import Project from models.user import User from schemas.organization import ProjectOut from services.organizat...
siddharthgaur1/openeval
backend/api/projects.py
.py
c03653bc642eea02
7
0
from datetime import datetime from uuid import UUID from fastapi import Depends, HTTPException, status from sqlalchemy.orm import Session from api.deps import get_current_user from core.database import get_db from models.eval import EvalRun from models.organization import ROLE_RANK, Membership from models.project imp...
siddharthgaur1/openeval
backend/api/rbac.py
.py
f65cb3b7dcf2b2c6
7
0
from abc import ABC, abstractmethod class Evaluator(ABC): name: str @abstractmethod def score(self, *, input: str, output: str, expected_output: str | None, context: str | None, judge_model: str) -> float: """Return a score in [0, 1].""" raise NotImplementedError def split_context(conte...
siddharthgaur1/openeval
backend/evaluators/base.py
.py
15304f3691c31b42
7
0
import litellm from deepeval.models.base_model import DeepEvalBaseLLM class LiteLLMDeepEvalModel(DeepEvalBaseLLM): """Adapts any litellm-supported model (openai/anthropic/gemini/ollama/...) to DeepEval's model interface, so DeepEval metrics use the same judge_model the rest of the eval engine is configure...
siddharthgaur1/openeval
backend/evaluators/deepeval_llm.py
.py
d56e40fbfffce32c
7
0
from deepeval.metrics import FaithfulnessMetric from deepeval.test_case import LLMTestCase from evaluators.base import Evaluator, split_context from evaluators.deepeval_llm import LiteLLMDeepEvalModel class FaithfulnessEvaluator(Evaluator): """RAG groundedness: does every claim in the answer trace back to the re...
siddharthgaur1/openeval
backend/evaluators/faithfulness.py
.py
4461f7e320eed9db
7
0
from deepeval.metrics import HallucinationMetric from deepeval.test_case import LLMTestCase from evaluators.base import Evaluator, split_context from evaluators.deepeval_llm import LiteLLMDeepEvalModel class HallucinationEvaluator(Evaluator): """Does the answer contradict or invent facts beyond the known source ...
siddharthgaur1/openeval
backend/evaluators/hallucination.py
.py
20059189b255289b
7
0
"""RAG context-quality metrics from the original RAGAS metric set. context_precision / context_recall are backed by DeepEval's ContextualPrecisionMetric / ContextualRecallMetric (the same algorithms RAGAS implements: LLM-judged relevance/ attribution of each retrieved chunk against the expected answer). context_entit...
siddharthgaur1/openeval
backend/evaluators/rag_context.py
.py
1fd31434f09e27f5
7
0
from deepeval.metrics import AnswerRelevancyMetric from deepeval.test_case import LLMTestCase from evaluators.base import Evaluator from evaluators.deepeval_llm import LiteLLMDeepEvalModel class AnswerRelevanceEvaluator(Evaluator): """How relevant is the answer to the question? Backed by DeepEval's AnswerRel...
siddharthgaur1/openeval
backend/evaluators/relevance.py
.py
56e9a868c485c0de
7
0
import uuid from datetime import datetime from sqlalchemy import DateTime, ForeignKey, JSON, String, Text from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import Mapped, mapped_column from core.database import Base class AnnotationQueueItem(Base): """One trace assigned to one reviewer for hum...
siddharthgaur1/openeval
backend/models/annotation.py
.py
a4616d7a59d3bd4b
7
0
# scripts/mutate_limits.py """Mutate every ceiling a pull request changes, and fail on a survivor. A constant in `analysis/limits.py` can be read by nothing any test exercises, so moving it changes nothing observable and the suite stays green. The corrected #259 sweep measured that over the whole module: 13 of 28 muta...
shauneccles/dbml-sharepoint
scripts/mutate_limits.py
.py
a13d5e57f6d80ba6
7
0
# src/dbml_sharepoint/analysis/checks/_provenance.py """Names the marker interpolates, and the terminator they may not hold. The deploy tests for the marker with a substring search, which is sound only while no marker can sit inside another. That holds only while no interpolated name contains the terminator, so refusi...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/checks/_provenance.py
.py
31733a1269094694
7
0
# src/dbml_sharepoint/analysis/checks/context.py """Derived lookups shared by every mapping check. Each check family needs the same handful of indexes over the schema and the mapping. Building them once here keeps the individual checks readable and stops two of them disagreeing about how a lookup is derived. Everythi...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/checks/context.py
.py
62e82e80f47a0beb
7
0
# src/dbml_sharepoint/analysis/column_refs.py """Column names written inside a calculated formula or a formatter JSON. Read by rule modules under `analysis/checks/` and by `generators/jsgen.py`, which orders Phase-1 field creation by a formula's references, so it lives outside both packages. It is not named `reference...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/column_refs.py
.py
95667e33b00167ec
7
0
# src/dbml_sharepoint/analysis/forms.py """Composing declared form visibility into a single stored formula. SharePoint gives a column exactly one `ClientValidationFormula`, so per-form visibility and conditional visibility must be combined at build time or declaring one would silently destroy the other. That compositi...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/forms.py
.py
7f8d8f4d7d141bfa
7
0
# src/dbml_sharepoint/analysis/group_description.py """How a site group's Description is composed, shared by the generator and the rule. Both sides need the same fact: the marker's exact text and the budget it leaves for a human sentence. This module is the single spelling authority, imported by `generators.jsgen` and...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/group_description.py
.py
ce05439793fe274e
7
0
"""How many join operations a view performs, and which of its columns pay one. Shared for the same reason `lookups.py` is: the validator refuses a view the platform would render blank, and `generators.jsgen` builds the one view no author declares. Computed separately, a drift between them means a build that passes a v...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/joins.py
.py
4496e8aef47b4be7
7
0
"""Which entities a lookup points at, and what such a lookup displays. Derived in one place because two consumers read it and they must not disagree: `analysis.checks.context` folds the answer into `effective_indexes` so the per-list ceiling counts it, and `generators.jsgen` emits it so the deployer creates it. Comput...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/lookups.py
.py
ebe4914c214875b7
7
0
# src/dbml_sharepoint/analysis/ordering.py """Two-pass dependency resolution. Phase 2.1: create lists in topological order, with non-lookup columns and as many lookup columns as can be resolved (target already created). Phase 2.2: add the remaining lookup columns (self-references, any side of a strongly connected com...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/ordering.py
.py
10b35e5e118e4b37
7
0
# src/dbml_sharepoint/analysis/permissions.py """SP base permissions bitmask + permission-level / group / role-assignment helpers.""" from collections.abc import Iterable from dataclasses import dataclass from dbml_sharepoint.model.mapping_types import Mapping # Per Microsoft.SharePoint.SPBasePermissions (64-bit uns...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/permissions.py
.py
f640ded4f86d809c
7
0
# src/dbml_sharepoint/analysis/phases.py """The deploy-phase manifest: THE single source of phase truth. Group/step numbers derive from position here. Add or move a step and every consumer renumbers automatically: deploy.js banners/Starting lines/[Phase X.Y] prefixes/error tags (templates receive phases_context()), th...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/phases.py
.py
d0942257d54bbe09
7
0
# src/dbml_sharepoint/analysis/provenance.py """The provenance marker every provisioned object carries, and its grammar. Three surfaces record provenance in a description: a site group, a list, and a permission level. All three build their marker here, so a change to the grammar reaches every surface at once and no tw...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/provenance.py
.py
bc6f9db65f9a39c5
7
0
# src/dbml_sharepoint/analysis/rendered_columns.py """Which columns a provisioned SharePoint list actually has. Every check family reads `rendered_columns`, and so does `analysis/joins.py` (which a generator may import, unlike `analysis/checks/`), so this is a shared fact rather than a private helper of the orchestrat...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/rendered_columns.py
.py
827181926c8ed03a
7
0
# src/dbml_sharepoint/analysis/role_definition_description.py """How a permission level's Description is composed, shared by the generator and the rule. Both sides need the same fact: the marker's exact text and the budget it leaves for a human sentence. This module is the single spelling authority, imported by `gener...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/role_definition_description.py
.py
e1c5647e12baa7a4
7
0
# src/dbml_sharepoint/analysis/styles.py """The fleet style standard: semantic tokens + parameterised column styles. Tokens resolve to SharePoint's OWN documented formatting classes (the sp-field-severity--* set plus sanctioned Fluent UI background classes) with the Learn reference's canonical Fluent icon pairings, ne...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/styles.py
.py
3c732b198b2c1132
7
0
# src/dbml_sharepoint/analysis/validator.py """Validation rules for the parsed schema.""" from collections import Counter from dataclasses import replace from dbml_sharepoint.analysis import typemap from dbml_sharepoint.analysis.checks import CHECK_FAMILIES from dbml_sharepoint.analysis.checks.context import Validati...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/analysis/validator.py
.py
cb0d1b88145a74cb
7
0
# src/dbml_sharepoint/bundle.py """Bundle-level packaging shared by the core and extension CLIs. A successful build emits a fixed artifact set, the deployment bundle. This module owns the cross-cutting concerns: the canonical artifact name list, stale-artifact clearing, platform-stable content hashing, and the index.m...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/bundle.py
.py
49334f6a3cb36b91
7
0
"""The shipped solution templates, as data the wizard can offer. One `Solution` per directory under `solutions/`. Everything here is read-only discovery: nothing in this module writes, validates or deploys. Discovered by glob, never by roster. A hardcoded list of names fails open. A new template is simply never offer...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/catalogue.py
.py
2386a8a54e3ccef2
7
0
# src/dbml_sharepoint/extension.py """The deployment-extension protocol: the hook names, parameter order, and return types; this skeleton conforms to it. Validation issues are reported with `analysis.findings.Finding`.""" from dataclasses import dataclass, field from importlib.metadata import entry_points from pathlib ...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/extension.py
.py
8260224829675b36
7
0
# src/dbml_sharepoint/extract/field_xml.py """CAML `<Field>` XML to a normalised field record. A live read returns one of these elements in each field's `SchemaXml` property, and it is everything the extraction has to work from. Nothing in this module interprets a field as a DBML type. It reports what the element say...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/extract/field_xml.py
.py
5300f763577d5065
7
0
# src/dbml_sharepoint/extract/folder.py """The per-list folder: where one list's extraction lives. Both halves of the flow land here. `extract-script` seeds the folder with the browser-paste script and a readme; `extract` writes the draft schema, the mapping and the notes into the same one. The folder is named after t...
shauneccles/dbml-sharepoint
src/dbml_sharepoint/extract/folder.py
.py
590b3f6fbbf4b987
7
0
# -*- coding: utf-8 -*- """以 Gmail API 寄送通知信。 沿用與 persistence.py 相同的憑證 (GOOGLE_CLIENT_ID / SECRET / REFRESH_TOKEN), 但該 refresh token 需含 gmail.send scope (重新授權取得)。 寄件者 = 授權的 Google 帳號本身;收件人 = 各使用者的通知信箱。 環境變數: PM_MAIL_FROM_NAME 寄件者顯示名稱 (預設「專案管理系統」) PM_NOTIFY_DRYRUN "1" 時不真的寄 (app.py 端控制,mailer 本身總是真寄) """ impo...
fantasy1164/pm-system
backend/mailer.py
.py
fec778e95e87b397
7
0
# -*- coding: utf-8 -*- """產生 app.ico —— 甘特圖意象的應用程式圖示。 app.ico 已隨版本庫提供,平常不需要跑這支;想換配色或造型時才用: pip install pillow python make_icon.py 輸出多尺寸 (16-256px) 的單一 .ico,Windows 檔案總管/工作列/桌面各取所需。 """ import os from PIL import Image, ImageDraw HERE = os.path.dirname(os.path.abspath(__file__)) OUT = os.path.join(HERE, "ap...
fantasy1164/pm-system
standalone/build/make_icon.py
.py
1d21484773974fa3
7
0
""" AI Engine API routes for Kronos Financial Foundation Model forecasting. """ from typing import Optional from fastapi import APIRouter, HTTPException, Query from pydantic import BaseModel, Field from backend.app.core.data_engine import data_engine from backend.app.core.search_engine import SearchEngine from backen...
srathi/SwingTradeDeskPro
backend/app/api/ai_routes.py
.py
7832aeb9a1292242
7
0
""" Backtest API Routes with Symbol Resolution and Robust Cost Models. """ from typing import Optional, Dict, Any, List from fastapi import APIRouter, HTTPException from pydantic import BaseModel from backend.app.core.data_engine import data_engine from backend.app.core.index_manager import IndexManager from backend....
srathi/SwingTradeDeskPro
backend/app/api/backtest_routes.py
.py
f339a5099b46f867
7.5
0
""" Risk Management and Position Sizing API Routes. """ from typing import Optional from fastapi import APIRouter from pydantic import BaseModel from backend.app.core.risk_calculator import calculate_position_sizing router = APIRouter(prefix="/api/risk", tags=["Risk"]) class SizingRequest(BaseModel): capital: f...
srathi/SwingTradeDeskPro
backend/app/api/risk_routes.py
.py
9bbf95f7c416aa22
7
0
""" Screener API Routes and WebSocket Live Scanner Stream. """ import json import asyncio from typing import List, Dict, Any, Optional from fastapi import APIRouter, WebSocket, WebSocketDisconnect, Query from pydantic import BaseModel import numpy as np import pandas as pd from backend.app.core.index_manager import I...
srathi/SwingTradeDeskPro
backend/app/api/screener_routes.py
.py
af36a04fd3812ec1
7
0
""" SectorPulse REST API Routes. Serves real-time quantitative sector rotation intelligence, Relative Strength regimes, and exhaustion forecasts. """ from typing import Optional, List, Dict, Any from fastapi import APIRouter, Query, HTTPException from sectorpulse.engine import SectorPulseEngine from sectorpulse.data_...
srathi/SwingTradeDeskPro
backend/app/api/sector_routes.py
.py
e1d13e2d6360b06b
7
0
""" Institutional Backtesting Simulation Engine with Realistic Indian Market Cost Models. Simulates bar-by-bar trade execution with slippage, STT, GST, brokerage, and risk-managed position sizing. """ import math import numpy as np import pandas as pd from typing import Dict, List, Any, Optional from backend.app.strat...
srathi/SwingTradeDeskPro
backend/app/backtester/engine.py
.py
89e909ca40616046
7.5
0
""" Data Engine with Yahoo Finance Ingestion, Intelligent Fuzzy Name Resolution, and SQLite Disk Caching. Provides fast, rate-limited, and cached OHLCV market data for Indian and global equities. """ import os import io import sqlite3 import datetime import pandas as pd import yfinance as yf from typing import List, D...
srathi/SwingTradeDeskPro
backend/app/core/data_engine.py
.py
660ce02525b98514
7
0
""" Vectorized, High-Performance Technical Indicator Engine. Implemented with pure NumPy and Pandas for institutional-grade reliability, exact alignment with TradingView/Zerodha calculations, and zero external C-dependencies. """ import numpy as np import pandas as pd from typing import Tuple, Dict def sma(series: p...
srathi/SwingTradeDeskPro
backend/app/core/indicator_engine.py
.py
930b034c4e9afc45
7
0
""" FastAPI Main Application Entrypoint for Institutional Swing Trading Platform. Developed by rupeemap.in labs (by Sandesh Rathi). """ import os from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.staticfiles import StaticFiles from fastapi.responses import FileResponse from b...
srathi/SwingTradeDeskPro
backend/app/main.py
.py
4701341cd7027cab
7
0
""" Base Strategy Interface for Quantitative Swing Trading Models. """ from abc import ABC, abstractmethod from typing import Dict, Any, Optional import pandas as pd class BaseStrategy(ABC): name: str = "Base Strategy" strategy_id: str = "base" description: str = "" default_params: Dict[str, Any] = {...
srathi/SwingTradeDeskPro
backend/app/strategies/base.py
.py
f0bd77d48b90af26
7
0
""" Guppy Multiple Moving Average (GMMA) Breakout & Trend Expansion Strategy. Identifies high-probability Stage 2 trend expansions by entering equities where the fast trader ribbon (3-15 EMA) is actively expanding above the fanning slow investor ribbon (30-60 EMA) with breakout/trend momentum. """ from typing import D...
srathi/SwingTradeDeskPro
backend/app/strategies/gmma_breakout.py
.py
ffcdd7f98e84f25b
7
0
""" Institutional Pocket Pivot Strategy (Gil Morales & Chris Kacher / William O'Neil Research). Identifies inside-the-base institutional volume accumulation where volume on an upward bounce off the 10/20/50 EMA is higher than the maximum down-volume of the past 10 trading sessions. Allows early positioning before tradi...
srathi/SwingTradeDeskPro
backend/app/strategies/pocket_pivot.py
.py
a46671f666a44a50
7
0
""" Mansfield Relative Strength Stage-2 Leader Strategy. Research: Stan Weinstein (1988) — Stage Analysis / Gary Antonacci — Dual Momentum (2014). Alpha Edge: Detects institutional accumulation in market-leading equities outperforming the Nifty 50 benchmark (MRS > 0) breaking out of Stage-1 consolidation bases on heavy...
srathi/SwingTradeDeskPro
backend/app/strategies/relative_strength_leader.py
.py
eed5919f5abe3cdc
7
0
""" RSI(28) Multi-Week Momentum Divergence Strategy. Captures high-probability intermediate swing reversals by identifying structural bullish divergences between price lower-lows / double-bottoms and smoothed 28-period Wilder RSI higher-lows. """ from typing import Dict, Any, Optional, List, Tuple import numpy as np i...
srathi/SwingTradeDeskPro
backend/app/strategies/rsi28_divergence.py
.py
3de236d7a762775e
7
0