repo stringclasses 44
values | path stringlengths 6 100 | size int64 146 125k | copies int64 0 0 | license stringclasses 1
value | content stringlengths 146 125k | token_count int64 51 32.1k | hash stringlengths 64 64 | line_mean float64 12.5 80.7 | line_max int64 30 924 | alpha_frac float64 0.36 0.8 | ratio float64 1.55 5.96 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
crestalnetwork/intentkit | skills/allora/__init__.py | 2,059 | 0 | MIT License | """Allora skill module."""
import logging
from typing import NotRequired, TypedDict
from abstracts.skill import SkillStoreABC
from skills.allora.base import AlloraBaseTool
from skills.allora.price import AlloraGetPrice
from skills.base import SkillConfig, SkillState
# Cache skills at the system level, because they a... | 547 | c8f767634a1da118872662344f775f97a5819481ad9691ae3885297785e36aca | 23.807229 | 70 | 0.641088 | 3.764168 | false | true | false | false |
pydantic/pydantic-ai | tests/models/test_cohere.py | 12,440 | 0 | MIT License | from __future__ import annotations as _annotations
import json
from collections.abc import Sequence
from dataclasses import dataclass
from datetime import timezone
from typing import Any, Union, cast
import pytest
from inline_snapshot import snapshot
from pydantic_ai import Agent, ModelHTTPError, ModelRetry
from pyd... | 2,992 | 12d11bb6596db25ba3dcaeb857c4eeccd5026878e60f7a7ebd783c844c83de16 | 33.269972 | 117 | 0.552814 | 4.157754 | false | false | false | false |
HKUDS/LightRAG | examples/get_all_edges_nx.py | 1,253 | 0 | MIT License | import networkx as nx
G = nx.read_graphml("./dickensTestEmbedcall/graph_chunk_entity_relation.graphml")
def get_all_edges_and_nodes(G):
# Get all edges and their properties
edges_with_properties = []
for u, v, data in G.edges(data=True):
edges_with_properties.append(
{
... | 337 | 5e1df27c5f96f08f2ceec7e1dedd734bb25c5cd1f01b37011304b4b500b7314a | 30.325 | 81 | 0.548284 | 3.718101 | false | false | false | false |
meta-llama/llama-stack | llama_stack/models/llama/llama3_1/prompts.py | 12,244 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the ... | 2,524 | 7e69e6e476cd1ff344a20cf4195b03f5316a1ee747b7cca8277c7eef362a3c64 | 46.457364 | 413 | 0.527932 | 4.85103 | false | false | false | false |
crestalnetwork/intentkit | app/services/twitter/oauth2_callback.py | 4,968 | 0 | MIT License | """Twitter OAuth2 callback handler."""
from datetime import datetime, timezone
from typing import Optional
from urllib.parse import parse_qs, urlencode, urlparse
import tweepy
from fastapi import APIRouter, HTTPException
from starlette.responses import JSONResponse, RedirectResponse
from app.config.config import con... | 1,184 | f3097720036c5038918e113b07983f57e6afac2e25e38a2e6457797fbae03ac6 | 35.262774 | 100 | 0.625403 | 4.195946 | false | false | false | false |
virattt/ai-hedge-fund | src/data/models.py | 3,736 | 0 | MIT License | from pydantic import BaseModel
class Price(BaseModel):
open: float
close: float
high: float
low: float
volume: int
time: str
class PriceResponse(BaseModel):
ticker: str
prices: list[Price]
class FinancialMetrics(BaseModel):
ticker: str
report_period: str
period: str
... | 1,023 | d0955b70c6fd1fe552c85c4b576a1d4c6e26e16ccf67d3288ec98fcf52439cf0 | 24.073826 | 77 | 0.680675 | 3.652004 | false | false | false | false |
meta-llama/llama-stack | llama_stack/apis/common/deployment_types.py | 753 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from enum import Enum
from typing import Any, Dict, Optional
from pydantic import BaseModel
from llama_stack.apis.com... | 216 | f074cd9f2c3f20aeda5fd5ceba097b16cdd8e67741a7e2a350279a6d2bb7792a | 24.1 | 79 | 0.722444 | 3.486111 | false | false | false | false |
meta-llama/llama-stack | llama_stack/models/llama/llama4/ffn.py | 2,196 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the ... | 642 | 9149f23fe08c0db08c6b5b29f4926d13cab37ba4c8f79a2942186afe8f43e39d | 36.862069 | 113 | 0.651639 | 3.420561 | false | false | false | false |
MadcowD/ell | examples/future/limbo.py | 1,455 | 0 | MIT License | from typing import List
import ell
from ell.types.message import Message
ell.init(verbose=True, store='./logdir', autocommit=True)
@ell.tool()
def order_t_shirt(size : str, color : str, address : str):
# ....\
pass
@ell.tool()
def get_order_arrival_date(order_id: str):
"""Gets the arrival date o... | 421 | bc5531025ccf18b168f4a8ba117b0dfe3f0dad44e073b04b60137883626cf182 | 28.693878 | 262 | 0.646048 | 3.456057 | false | false | false | false |
crestalnetwork/intentkit | app/admin/api.py | 29,057 | 0 | MIT License | import asyncio
import importlib
import json
import logging
from typing import TypedDict
from aiogram import Bot
from aiogram.exceptions import TelegramConflictError, TelegramUnauthorizedError
from aiogram.utils.token import TokenValidationError
from cdp import Wallet
from cdp.cdp import Cdp
from fastapi import (
A... | 6,813 | b7c0c7b4f2116e0390c1f2f1d072ec17465497bfec0a45bc2869078d91f3a458 | 31.86991 | 106 | 0.588808 | 4.264935 | false | true | false | false |
fudan-generative-vision/hallo2 | basicsr/data/__init__.py | 4,254 | 0 | MIT License | import importlib
import numpy as np
import random
import torch
import torch.utils.data
from copy import deepcopy
from functools import partial
from os import path as osp
from basicsr.data.prefetch_dataloader import PrefetchDataLoader
from basicsr.utils import get_root_logger, scandir
from basicsr.utils.dist_util impor... | 1,161 | 3214fde7389be3f63e073e38f206d7448efe6d9b49bab3fd55f2eb1dac16216a | 41.54 | 113 | 0.657029 | 3.664083 | false | false | false | false |
meta-llama/llama-stack | llama_stack/providers/remote/inference/nvidia/openai_utils.py | 7,685 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import warnings
from typing import Any, AsyncGenerator, Dict, List, Optional
from openai import AsyncStream
from opena... | 2,104 | f82873fb13c906f185bfab605e378ce0141d4c304d83760fab397b7ef7f0d0ea | 34.578704 | 119 | 0.668705 | 3.652567 | false | false | false | false |
trycua/cua | libs/agent/agent/providers/anthropic/types.py | 421 | 0 | MIT License | from enum import StrEnum
class LLMProvider(StrEnum):
"""Enum for supported API providers."""
ANTHROPIC = "anthropic"
BEDROCK = "bedrock"
VERTEX = "vertex"
PROVIDER_TO_DEFAULT_MODEL_NAME: dict[LLMProvider, str] = {
LLMProvider.ANTHROPIC: "claude-3-7-sonnet-20250219",
LLMProvider.BEDROCK: "an... | 161 | 9f0fefaa638a906a2dee096912b6fa6069b5ff916d47297342eb3b0f1cabe484 | 25.3125 | 69 | 0.700713 | 2.614907 | false | false | false | false |
meta-llama/llama-stack | llama_stack/providers/utils/telemetry/sqlite_trace_store.py | 6,946 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import json
from datetime import datetime
from typing import Dict, List, Optional, Protocol
import aiosqlite
from lla... | 1,672 | 3ad99d3123bf995e22334dc4d1869ca72bdd343bb4bebfd340936dfbbb38071f | 36.344086 | 118 | 0.530089 | 4.154306 | false | false | false | false |
autoscrape-labs/pydoll | pydoll/browser/page.py | 25,924 | 0 | MIT License | import asyncio
import json
import logging
from contextlib import asynccontextmanager
from functools import partial
from pathlib import Path
from typing import List, Optional, Tuple, Union
import aiofiles
from pydoll.commands import (
DomCommands,
FetchCommands,
NetworkCommands,
PageCommands,
Runti... | 5,539 | f3a968ce0028c85f9d309a9d22ea60f7d3fcd2a98c7d49687251526a25d2701c | 31.486216 | 79 | 0.586638 | 4.680267 | false | false | false | false |
openai/openai-agents-python | src/agents/extensions/handoff_filters.py | 1,977 | 0 | MIT License | from __future__ import annotations
from ..handoffs import HandoffInputData
from ..items import (
HandoffCallItem,
HandoffOutputItem,
RunItem,
ToolCallItem,
ToolCallOutputItem,
TResponseInputItem,
)
"""Contains common handoff input filters, for convenience. """
def remove_all_tools(handoff_in... | 533 | 7da5d4e08f0d80b8d44816665c6bc70024922afb10e68b599c44ce255823ce07 | 28.507463 | 95 | 0.650986 | 3.709193 | false | false | false | false |
browser-use/browser-use | examples/use-cases/google_sheets.py | 7,576 | 0 | MIT License | import os
import sys
from browser_use.browser.context import BrowserContext
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import asyncio
import pyperclip
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from browser_use import ActionResult, Agent, Controller
from... | 2,298 | 623f6d876c280782cedee4a319aa635d451ac4dbde667498850d02757688e115 | 38.253886 | 154 | 0.757128 | 3.29678 | false | false | false | false |
HKUDS/AutoAgent | autoagent/workflows/math_solver_workflow_flow.py | 8,795 | 0 | MIT License | import asyncio
import json
import argparse
from openai import AsyncOpenAI
from openai.types.chat import ChatCompletionMessageToolCall
from autoagent.flow import default_drive, EventInput, ReturnBehavior
from autoagent.flow.dynamic import goto_events, abort_this
import re
from autoagent import MetaChain
from autoagent.t... | 2,320 | c86700e0fd59c6b80869c02761a41ded8e8ea73a9979cb1a6bacfc6807888ce7 | 42.756219 | 272 | 0.612166 | 3.790948 | false | false | false | false |
MadcowD/ell | examples/claude.py | 387 | 0 | MIT License | import ell # type: ignore
@ell.simple(model="claude-3-5-sonnet-20241022", max_tokens=100)
def hello_from_claude():
"""You are an AI assistant. Your task is to respond to the user's message with a friendly greeting."""
return "Say hello to the world!!!"
if __name__ == "__main__":
ell.init(verbose=True, ... | 124 | e4c04ea149b61475c86a19b1b3cec0ffaf179b02e6cef871cd068c354a327e47 | 31.25 | 106 | 0.666667 | 3.120968 | false | false | false | false |
fudan-generative-vision/hallo | scripts/train_stage2.py | 37,347 | 0 | MIT License | # pylint: disable=E1101,C0415,W0718,R0801
# scripts/train_stage2.py
"""
This is the main training script for stage 2 of the project.
It imports necessary packages, defines necessary classes and functions, and trains the model using the provided configuration.
The script includes the following classes and functions:
... | 9,334 | 4d47c87601970edb30a6004ea1f343f7e1b3fffcbef50adb7d2729a39fc672af | 36.686176 | 126 | 0.590891 | 4.001178 | false | false | false | false |
microsoft/TRELLIS | dataset_toolkits/datasets/HSSD.py | 3,654 | 0 | MIT License | import os
import re
import argparse
import tarfile
from concurrent.futures import ThreadPoolExecutor
from tqdm import tqdm
import pandas as pd
import huggingface_hub
from utils import get_file_hash
def add_args(parser: argparse.ArgumentParser):
pass
def get_metadata(**kwargs):
metadata = pd.read_csv("hf://d... | 941 | 2941f745453ea7f0e0e270ce24debab54a8e2721fc0a4b92b0a5a14fbb63bf49 | 34.475728 | 158 | 0.594964 | 3.883103 | false | false | false | false |
crestalnetwork/intentkit | models/chat.py | 13,110 | 0 | MIT License | from datetime import datetime, timezone
from enum import Enum
from typing import Annotated, List, NotRequired, Optional, TypedDict
from epyxid import XID
from pydantic import BaseModel, ConfigDict, Field
from sqlalchemy import (
Column,
DateTime,
Index,
Integer,
String,
desc,
func,
sele... | 3,097 | cb04f18b0eb11daf597ef026763242849b49b234c6b258405f98bea0f105c1dd | 26.086777 | 130 | 0.567963 | 4.233129 | false | false | false | false |
HKUDS/LightRAG | examples/test_faiss.py | 3,131 | 0 | MIT License | import os
import logging
import asyncio
import numpy as np
from dotenv import load_dotenv
from sentence_transformers import SentenceTransformer
from openai import AzureOpenAI
from lightrag import LightRAG, QueryParam
from lightrag.utils import EmbeddingFunc
from lightrag.kg.shared_storage import initialize_pipeline_s... | 891 | f9aa4ec3013a075aa647c538d48f23174dfc25344700f11a0d1e1fa15d13a51d | 27.990741 | 87 | 0.672629 | 3.514029 | false | false | false | false |
meta-llama/llama-stack | llama_stack/providers/inline/agents/meta_reference/agent_instance.py | 39,347 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import copy
import json
import re
import secrets
import string
import uuid
from datetime import datetime, timezone
from... | 8,299 | 58a40e03fad2e8c63aac99a8d2fbae5d83eb98f5aeb87ead175fc0e4e7d2fa90 | 41.308602 | 157 | 0.528401 | 4.741174 | false | false | false | false |
xinnan-tech/xiaozhi-esp32-server | main/xiaozhi-server/core/providers/asr/tencent.py | 8,954 | 0 | MIT License | import base64
import hashlib
import hmac
import json
import time
from datetime import datetime, timezone
import os
import uuid
from typing import Optional, Tuple, List
import wave
import opuslib_next
import requests
from core.providers.asr.base import ASRProviderBase
from config.logger import setup_logging
TAG = __na... | 2,921 | faace4123bc1aeb555bc9667aa91f08c1a9c642aa83e618651f119e3bfaf5b5a | 34.677291 | 115 | 0.528032 | 3.065389 | false | false | false | false |
browser-use/browser-use | browser_use/browser/utils/screen_resolution.py | 1,284 | 0 | MIT License | import sys
def get_screen_resolution():
if sys.platform == 'darwin': # macOS
try:
from AppKit import NSScreen
screen = NSScreen.mainScreen().frame()
return {'width': int(screen.size.width), 'height': int(screen.size.height)}
except ImportError:
print('AppKit is not available. Make sure you are runn... | 374 | 3a765131be43abbcf5407364ce053cdff4dff10a22b0b9c2728fd75e64fd3da0 | 30.317073 | 99 | 0.692368 | 3.433155 | false | false | false | false |
circlemind-ai/fast-graphrag | fast_graphrag/_llm/_base.py | 3,829 | 0 | MIT License | """LLM Services module."""
from dataclasses import dataclass, field
from typing import Any, Optional, Tuple, Type, TypeVar, Union
import numpy as np
from pydantic import BaseModel
from fast_graphrag._models import BaseModelAlias
from fast_graphrag._prompt import PROMPTS
T_model = TypeVar("T_model", bound=Union[Base... | 962 | b047af1d2b65078aa3e40258aa3678f411741ee177c9acaefdbe945e1952a1af | 36.174757 | 119 | 0.66153 | 3.980249 | false | false | false | false |
docling-project/docling | tests/test_code_formula.py | 2,071 | 0 | MIT License | from pathlib import Path
from docling_core.types.doc import CodeItem, TextItem
from docling_core.types.doc.labels import CodeLanguageLabel, DocItemLabel
from docling.backend.docling_parse_backend import DoclingParseDocumentBackend
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document i... | 562 | ff9026cda4c757cecca7e85aeab6cfa133cc55fb1245f8318cda98e784abe2db | 31.359375 | 78 | 0.703042 | 3.685053 | false | false | false | false |
BrainBlend-AI/atomic-agents | atomic-examples/orchestration-agent/orchestration_agent/orchestrator.py | 7,052 | 0 | MIT License | from typing import Union
import openai
from pydantic import Field
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig
from atomic_agents.lib.base.base_io_schema import BaseIOSchema
from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.lib.components.system_prompt_genera... | 1,777 | a5a1ea4bb55d4cb16242092454a35173e9a7cffa35926069bb9f1bb2d6f78e39 | 37.535519 | 131 | 0.682218 | 3.968486 | false | true | false | false |
HKUDS/LightRAG | examples/lightrag_zhipu_demo.py | 2,013 | 0 | MIT License | import os
import logging
import asyncio
from lightrag import LightRAG, QueryParam
from lightrag.llm.zhipu import zhipu_complete, zhipu_embedding
from lightrag.utils import EmbeddingFunc
from lightrag.kg.shared_storage import initialize_pipeline_status
WORKING_DIR = "./dickens"
logging.basicConfig(format="%(levelnam... | 561 | ca2ae1c1805a6a8cc533daf5430cbfedf2dfa590b73749df9df5f9ea1fa1f4fa | 24.1625 | 116 | 0.630402 | 3.588235 | false | false | false | false |
abus-aikorea/voice-pro | src/demucs/train.py | 8,068 | 0 | MIT License | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""Main training script entry point"""
import logging
import os
from pathlib import Path
import sy... | 2,338 | 13d2629975155efa37788395a489b7afced2ae31142770e96d81707f3bcd99a7 | 31.143426 | 98 | 0.620476 | 3.450813 | false | false | false | false |
HKUDS/AutoAgent | autoagent/agents/meta_agent/workflow_creator.py | 3,359 | 0 | MIT License | from autoagent.registry import register_agent
from autoagent.tools.meta.edit_agents import list_agents, create_agent, delete_agent, run_agent, read_agent, create_orchestrator_agent
from autoagent.tools.meta.edit_workflow import list_workflows, create_workflow, run_workflow
from autoagent.tools.terminal_tools import exe... | 797 | ebc3e05594c6ce2eb1bb890d4e6ec0c712b969b681fc59cf377285bd093c6494 | 40.469136 | 175 | 0.7532 | 4.214555 | false | false | false | false |
autoscrape-labs/pydoll | pydoll/commands/runtime.py | 3,010 | 0 | MIT License | import copy
class RuntimeCommands:
"""
A class for interacting with the JavaScript runtime using Chrome
DevTools Protocol.
This class provides methods to create commands for evaluating JavaScript
expressions, calling functions on JavaScript objects, and retrieving
object properties through CD... | 622 | fc8866232d07b2e5894bec3cde87098a1d69cb8f027907c0adcccb9eeab44d3b | 31.717391 | 79 | 0.609635 | 4.839228 | false | false | false | false |
xinnan-tech/xiaozhi-esp32-server | main/xiaozhi-server/plugins_func/functions/play_music.py | 7,114 | 0 | MIT License | from config.logger import setup_logging
import os
import re
import time
import random
import asyncio
import difflib
import traceback
from pathlib import Path
from core.utils import p3
from core.handle.sendAudioHandle import send_stt_message
from plugins_func.register import register_function,ToolType, ActionResponse, A... | 2,444 | ceea6b3d7735760141878e0a75f18e6bc4ca9447411f68596e80e2454cf8a76d | 35.295918 | 147 | 0.553556 | 2.910802 | false | false | false | false |
hkust-nlp/simpleRL-reason | train/openrlhf/trainer/ppo_utils/math_equal_file.py | 9,637 | 0 | MIT License | import re
import regex
import multiprocessing
from math import isclose
from typing import Union
from sympy import simplify, N
from sympy.parsing.sympy_parser import parse_expr
from sympy.parsing.latex import parse_latex
from latex2sympy2 import latex2sympy
from timeout_decorator import timeout, TimeoutError
def par... | 2,439 | 337e3da794a21fc80933d900f433ed749e7780a19132741c2312f9267c11d40e | 32.814035 | 186 | 0.531701 | 3.95121 | false | false | false | false |
meta-llama/llama-stack | tests/integration/post_training/test_post_training.py | 3,693 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from typing import List
import pytest
from llama_stack.apis.common.job_types import JobStatus
from llama_stack.apis.po... | 997 | 19dc93260b79a3b5fe78e702dfced43cc2457669864bf462fbd705fd3803745d | 35.564356 | 100 | 0.650149 | 3.704112 | false | true | false | false |
meta-llama/llama-stack | llama_stack/models/llama/llama3/template_data.py | 2,960 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the ... | 780 | df75136a7cb5c9b06c0c600012fbf217f5316a43f910dd840b8661622bd8ed37 | 24.517241 | 111 | 0.621959 | 3.794872 | false | false | false | false |
deepseek-ai/smallpond | tests/test_dataframe.py | 7,075 | 0 | MIT License | from typing import List
import pandas as pd
import pyarrow as pa
import pytest
from smallpond.dataframe import Session
def test_pandas(sp: Session):
pandas_df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
df = sp.from_pandas(pandas_df)
assert df.to_pandas().equals(pandas_df)
def test_arrow(sp: Sess... | 2,442 | 58d6267a114d139c2381ba62c6db950cad9d20f3af1a1c26f0233bd1b5aaafbb | 32.215962 | 126 | 0.561413 | 2.897215 | false | true | false | false |
MadcowD/ell | src/ell/types/lmp.py | 146 | 0 | MIT License | import enum
class LMPType(str, enum.Enum):
LM = "LM"
TOOL = "TOOL"
LABELER = "LABELER"
FUNCTION = "FUNCTION"
OTHER = "OTHER" | 51 | b51ce17d5d59adacb616a90c90f349dbaea12d0040393ab5f7727bd23aa0f959 | 15.333333 | 30 | 0.582192 | 2.862745 | false | false | false | false |
HKUDS/AutoAgent | autoagent/memory/rag_memory.py | 6,592 | 0 | MIT License | import uuid
import os.path
from datetime import datetime
from typing import List, Dict
import chromadb
from chromadb.utils import embedding_functions
from abc import ABC, abstractmethod
from openai import OpenAI
import numpy as np
from chromadb.api.types import QueryResult
chromadb.logger.setLevel(chromadb.logging.ERRO... | 1,529 | 0a1ea561dc56cc2f288b5a2b010cfc0f3513b83b5232d4620329f5a9952fed83 | 35.832402 | 129 | 0.590413 | 4.311315 | false | false | false | false |
deepseek-ai/DeepSeek-VL2 | inference.py | 6,418 | 0 | MIT License | # Copyright (c) 2023-2024 DeepSeek.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, dist... | 1,661 | d0b895db8029e0f75d4dfb8314b7b9af39f7895db1086090d364ad43505e8f00 | 37.431138 | 182 | 0.624338 | 3.863937 | false | false | false | false |
trycua/cua | libs/computer/computer/interface/models.py | 2,570 | 0 | MIT License | from enum import Enum
from typing import Dict, List, Any, TypedDict, Union, Literal
# Navigation key literals
NavigationKey = Literal['pagedown', 'pageup', 'home', 'end', 'left', 'right', 'up', 'down']
# Special key literals
SpecialKey = Literal['enter', 'esc', 'tab', 'space', 'backspace', 'del']
# Function key lite... | 752 | 8fe3c72508de4b012496bc474c9c9a60afee8f8065d5e34435b1b44815b3003b | 25.505155 | 96 | 0.556031 | 3.417553 | false | false | false | false |
openai/openai-agents-python | tests/mcp/test_caching.py | 1,928 | 0 | MIT License | from unittest.mock import AsyncMock, patch
import pytest
from mcp.types import ListToolsResult, Tool as MCPTool
from agents.mcp import MCPServerStdio
from .helpers import DummyStreamsContextManager, tee
@pytest.mark.asyncio
@patch("mcp.client.stdio.stdio_client", return_value=DummyStreamsContextManager())
@patch("... | 493 | 483f30cf6277cec4b8738e70af0fa115600a1e1b78f8ee8f0f4fa797057ddff1 | 32.824561 | 99 | 0.673237 | 3.910751 | false | true | false | false |
browser-use/browser-use | browser_use/browser/tests/test_clicks.py | 2,942 | 0 | MIT License | import asyncio
import json
import pytest
from browser_use.browser.browser import Browser, BrowserConfig
from browser_use.dom.views import DOMBaseNode, DOMElementNode, DOMTextNode
from browser_use.utils import time_execution_sync
class ElementTreeSerializer:
@staticmethod
def dom_element_node_to_json(element_tree:... | 915 | b2bcfeab491a9051ad100449ab0374d187ae00672c83f6f152344f045c1a7cb8 | 30.297872 | 100 | 0.690687 | 3.215301 | false | true | false | false |
crestalnetwork/intentkit | skills/defillama/yields/fetch_pools.py | 5,191 | 0 | MIT License | """Tool for fetching pool data via DeFi Llama API."""
from typing import Optional
from langchain.schema.runnable import RunnableConfig
from pydantic import BaseModel, Field
from skills.defillama.api import fetch_pools
from skills.defillama.base import DefiLlamaBaseTool
FETCH_POOLS_PROMPT = """
This tool fetches com... | 1,306 | 9f60a384fe6119cf337b889c19aefe6d106f3034bd03f9c281b48e36c5ec8e05 | 40.198413 | 88 | 0.690618 | 3.974732 | false | false | false | false |
xinnan-tech/xiaozhi-esp32-server | main/xiaozhi-server/plugins_func/functions/hass_get_state.py | 1,766 | 0 | MIT License | from plugins_func.register import register_function, ToolType, ActionResponse, Action
from plugins_func.functions.hass_init import initialize_hass_handler
from config.logger import setup_logging
import asyncio
import requests
TAG = __name__
logger = setup_logging()
hass_get_state_function_desc = {
"type": "functi... | 566 | 85a99d7171e828943a77cfc394e17f982e1b9f0d7414861e747a6ed98005dfa5 | 30.535714 | 88 | 0.607022 | 3.120141 | false | false | false | false |
MadcowD/ell | x/openai_realtime/tests/test_mock.py | 8,400 | 0 | MIT License | # x/openai_realtime/tests/test_mock.py
import pytest
from unittest.mock import Mock, patch, AsyncMock
import numpy as np
import json
from openai_realtime.client import RealtimeClient
from openai_realtime.utils import RealtimeUtils
@pytest.fixture
def client():
client = RealtimeClient()
client.realtime = Mock()... | 2,325 | 63ccb71d245fd86b3b221884783507eb92cce7f3d3e5fd311237177899d8a269 | 34.597458 | 108 | 0.651429 | 3.612903 | false | true | false | false |
MadcowD/ell | src/ell/stores/migrations/__init__.py | 3,678 | 0 | MIT License |
from alembic import command
from alembic.config import Config
from sqlalchemy import inspect, text
from pathlib import Path
from sqlmodel import Session, SQLModel, create_engine, select
import logging
logger = logging.getLogger(__name__)
def get_alembic_config(engine_url: str) -> Config:
"""Create Alembic confi... | 871 | 82d01a646f706d3e703ce04de2c383acf6de2d0b355c050fe21eb78d08202ec0 | 43.853659 | 120 | 0.65416 | 4.222732 | false | true | false | false |
MadcowD/ell | docs/ramblings/notes_on_adapters.py | 6,496 | 0 | MIT License | # How do we want to handle model adaptation..
# I don't really want to maitnain some base registry and update it every damn time a new model comes out, but it's not clear how we specify providers otherwise.
# e.g.
@ell.simple(model="gpt-4-turbo", temperature=0.1)
def blah():
pass
# Even then Azure is bullshit ... | 1,813 | 1e68421cc82666da1c88ae3271149faf0c0fd90b538ae5fca36c4e823720a2bb | 30.386473 | 316 | 0.716441 | 3.583012 | false | false | false | false |
meta-llama/llama-stack | llama_stack/providers/remote/inference/nvidia/config.py | 2,012 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import os
from typing import Any, Dict, Optional
from pydantic import BaseModel, Field, SecretStr
from llama_stack.sc... | 550 | 63d8860697cb44619ee4804ebafaca905649a674f55b4dbfa7c0fb9ed1fdd1cd | 34.928571 | 97 | 0.681412 | 3.658182 | false | true | false | false |
microsoft/markitdown | packages/markitdown-sample-plugin/src/markitdown_sample_plugin/_plugin.py | 1,824 | 0 | MIT License | import locale
from typing import BinaryIO, Any
from striprtf.striprtf import rtf_to_text
from markitdown import (
MarkItDown,
DocumentConverter,
DocumentConverterResult,
StreamInfo,
)
__plugin_interface_version__ = (
1 # The version of the plugin interface that this plugin uses
)
ACCEPTED_MIME_... | 439 | 4fd3c8aceacdf8c76cec1c9c2b41da3c8ac8abfada1897760089c7191a8255c6 | 24.690141 | 107 | 0.645833 | 4.154897 | false | false | false | false |
browser-use/browser-use | examples/features/restrict_urls.py | 954 | 0 | MIT License | import os
import sys
from langchain_openai import ChatOpenAI
from browser_use.browser.context import BrowserContextConfig
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import asyncio
from browser_use import Agent
from browser_use.browser.browser import Browser, BrowserConfig
llm = Ch... | 299 | 95283bb8bfd9d1fc02f586b25166b2feae7742836ef26933843abb1382e59dc3 | 20.681818 | 126 | 0.750524 | 3.190635 | false | true | false | false |
BrainBlend-AI/atomic-agents | atomic-examples/deep-research/deep_research/agents/qa_agent.py | 3,151 | 0 | MIT License | import instructor
import openai
from pydantic import Field
from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
from deep_research.config import ChatConfig
class QuestionAnsweringAgentInputSchema(Ba... | 645 | ed2cb8909ce5045a8ace247a7778fe7d9eb6e53449908e38ef6b3a23b7d4b543 | 49.015873 | 150 | 0.669629 | 4.885271 | false | true | false | false |
crestalnetwork/intentkit | app/services/tg/bot/kind/ai_relayer/router.py | 6,354 | 0 | MIT License | import inspect
import logging
import telegramify_markdown
from aiogram import Router
from aiogram.filters import Command, CommandStart
from aiogram.types import Message
from epyxid import XID
from app.core.client import execute_agent
from app.services.tg.bot import pool
from app.services.tg.bot.filter.chat_type impor... | 1,668 | 92f35730c12e33a0cd5fb428321da99b4a1d4e324ba591fe0fd35fc616be2907 | 33.16129 | 106 | 0.597891 | 3.809353 | false | false | false | false |
openai/openai-agents-python | examples/agent_patterns/output_guardrails.py | 2,354 | 0 | MIT License | from __future__ import annotations
import asyncio
import json
from pydantic import BaseModel, Field
from agents import (
Agent,
GuardrailFunctionOutput,
OutputGuardrailTripwireTriggered,
RunContextWrapper,
Runner,
output_guardrail,
)
"""
This example shows how to use output guardrails.
Outp... | 638 | 7a77c58ce62aa9773d0405d42e9a5df05c075f8f8533c287604d8c77be6f9cee | 28.425 | 123 | 0.696262 | 3.689655 | false | false | false | false |
MadcowD/ell | examples/evals/vibes.py | 703 | 0 | MIT License | import ell
from pydantic import BaseModel
class TweetInput(BaseModel):
input: str
@ell.simple(model="gpt-4o")
def tweet(obj: TweetInput):
print(obj)
return f"Write a tweet like roon in lower case about {obj.input}"
dataset = [
{"input": [TweetInput(input="Polymath")]},
{"input": [TweetInput(input="... | 226 | 5bd70ca8d6be6d3b54ffd89a49d769ef888e87f793e96b62562ef03f2ddf9ea4 | 21.677419 | 69 | 0.654339 | 3.110619 | false | false | false | false |
meta-llama/llama-stack | llama_stack/cli/verify_download.py | 4,620 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import argparse
import hashlib
from dataclasses import dataclass
from functools import partial
from pathlib import Path... | 1,130 | ec7457e5eb1d6ad268b62bdb1e5d7c7cb478efde7899018bd92ac51eb0157433 | 30.862069 | 107 | 0.619264 | 4.088496 | false | false | false | false |
circlemind-ai/fast-graphrag | fast_graphrag/_policies/_base.py | 2,627 | 0 | MIT License | from dataclasses import dataclass, field
from typing import Any, Generic, Iterable, Tuple, Type
from scipy.sparse import csr_matrix
from fast_graphrag._llm._llm_openai import BaseLLMService
from fast_graphrag._storage._base import BaseGraphStorage
from fast_graphrag._types import GTEdge, GTId, GTNode, TIndex
@datac... | 714 | 93e0e95789ccc2d5e46563a65e4a99595087cfcecb9a761eacaedea1190d180a | 36.528571 | 113 | 0.596117 | 3.679272 | false | false | false | false |
meta-llama/llama-stack | llama_stack/models/llama/llama4/model.py | 16,451 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import math
from typing import Any, Dict, List, Optional, Tuple
import fairscale.nn.model_parallel.initialize as fs_in... | 5,031 | 8dde12556653f529ad9d2fce1489e66130626e087e9a27b38d06ee5e78e53901 | 36.219457 | 120 | 0.584888 | 3.269926 | false | false | false | false |
MadcowD/ell | src/ell/studio/server.py | 11,417 | 0 | MIT License | from typing import Optional, Dict, Any, List
from sqlmodel import Session
from ell.stores.sql import PostgresStore, SQLiteStore
from ell import __version__
from fastapi import FastAPI, Query, HTTPException, Depends, Response, WebSocket, WebSocketDisconnect
from fastapi.middleware.cors import CORSMiddleware
import logg... | 2,877 | c80aa95802c3588f7805415be45158e03f69fa6a5cc10eff9ff350d5bd67d138 | 31.713467 | 165 | 0.601997 | 3.96837 | false | false | false | false |
crestalnetwork/intentkit | skills/goat/__init__.py | 8,249 | 0 | MIT License | """Goat skills."""
import importlib
import secrets
import time
from dataclasses import is_dataclass
from typing import (
Any,
Dict,
Literal,
Type,
Union,
get_args,
get_origin,
get_type_hints,
)
import httpx
from eth_account import Account
from eth_utils import encode_hex
from goat impo... | 2,143 | c73a02d38799d79682f61075ee75de3ddf3718ab59ab69adb49a3d0ec6aedd4b | 31.222656 | 97 | 0.583586 | 3.849277 | false | false | false | false |
openai/openai-agents-python | examples/research_bot/agents/writer_agent.py | 1,065 | 0 | MIT License | # Agent used to synthesize a final report from the individual summaries.
from pydantic import BaseModel
from agents import Agent
PROMPT = (
"You are a senior researcher tasked with writing a cohesive report for a research query. "
"You will be provided with the original query, and some initial research done b... | 269 | 02ea6872ed108536ba10f764f644ff823971bde885b5675cf6be670c52cfa12b | 31.272727 | 97 | 0.712676 | 3.959108 | false | false | false | false |
fudan-generative-vision/hallo2 | basicsr/utils/dist_util.py | 2,608 | 0 | MIT License | # Modified from https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/dist_utils.py # noqa: E501
import functools
import os
import subprocess
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=... | 745 | 7f2743d74bcc3e5cee369cfc7994f4a483b3339d778f8ad183f174fbf337f982 | 30.804878 | 102 | 0.646856 | 3.500671 | false | false | false | false |
BrainBlend-AI/atomic-agents | atomic-agents/tests/agents/test_base_agent.py | 9,746 | 0 | MIT License | import pytest
from unittest.mock import Mock, call, patch
from pydantic import BaseModel
import instructor
from atomic_agents.agents.base_agent import (
BaseIOSchema,
BaseAgent,
BaseAgentConfig,
BaseAgentInputSchema,
BaseAgentOutputSchema,
SystemPromptGenerator,
AgentMemory,
SystemPrompt... | 2,464 | b751f8bc0919c136acdb356536735475eee52ba7b1a1920a0894cfdeacb9b076 | 31.486667 | 120 | 0.702339 | 3.955357 | false | true | false | false |
grapeot/devin.cursorrules | tests/test_search_engine.py | 4,162 | 0 | MIT License | import unittest
from unittest.mock import patch, MagicMock
import sys
from io import StringIO
from tools.search_engine import search
class TestSearchEngine(unittest.TestCase):
def setUp(self):
# Capture stdout and stderr for testing
self.stdout = StringIO()
self.stderr = StringIO()
... | 1,023 | 62e2ec5cd530a5404f4e35c6f16ecd5c3cbcbf902e13811be3eded02dd56f161 | 34.271186 | 92 | 0.583854 | 4.068426 | false | true | false | false |
cyclotruc/gitingest | tests/query_parser/test_git_host_agnostic.py | 2,896 | 0 | MIT License | """
Tests to verify that the query parser is Git host agnostic.
These tests confirm that `parse_query` correctly identifies user/repo pairs and canonical URLs for GitHub, GitLab,
Bitbucket, Gitea, and Codeberg, even if the host is omitted.
"""
from typing import List
import pytest
from gitingest.query_parsing impor... | 747 | bab0b335b3cbda058e381f2a2fd480a441f0984976ff18483e760c7c2db9a3f3 | 29.484211 | 114 | 0.538674 | 3.876841 | false | true | false | false |
meta-llama/llama-stack | llama_stack/cli/stack/list_providers.py | 2,434 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import argparse
from llama_stack.cli.subcommand import Subcommand
class StackListProviders(Subcommand):
def __in... | 577 | 83603f38080fbc122dc24ddf25ab7e72b490e3164cbeff09d79ae3e89e261d41 | 31.026316 | 93 | 0.578472 | 4.218371 | false | false | false | false |
HKUDS/AutoAgent | process_tool_docs.py | 784 | 0 | MIT License | from pandas import read_csv
import json
from rich import print
df = read_csv("tool_docs.csv")
rapidapi_tools = df[df['Platform'] == 'RapidAPI']['Tool_Name'].unique()
print("[bold blue]Current RapidAPI tools:[/bold blue]")
print(json.dumps(rapidapi_tools.tolist(), indent=4))
print("[bold red][IMPORTANT][/bold red] [bo... | 242 | 180d31ae6d2bcff41f12fe3907bdf6b79c6698c0cff3ccc2b6ca465e4a52cb34 | 38.25 | 220 | 0.716837 | 3.239669 | false | false | false | false |
autoscrape-labs/pydoll | pydoll/exceptions.py | 2,008 | 0 | MIT License | class ConnectionFailed(Exception):
message = 'Failed to connect to the browser'
def __str__(self):
return self.message
class InvalidCommand(Exception):
message = 'The command provided is invalid'
def __str__(self):
return self.message
class InvalidCallback(Exception):
message =... | 457 | 1ffb4dfa08865a26dced8fc8adf83f46b9235fbd71a3024784ec20026d4f0257 | 19.282828 | 60 | 0.659363 | 4.393873 | false | false | false | false |
pydantic/pydantic-ai | examples/pydantic_ai_examples/chat_app.py | 7,089 | 0 | MIT License | """Simple chat app example build with FastAPI.
Run with:
uv run -m pydantic_ai_examples.chat_app
"""
from __future__ import annotations as _annotations
import asyncio
import json
import sqlite3
from collections.abc import AsyncIterator
from concurrent.futures.thread import ThreadPoolExecutor
from contextlib imp... | 1,797 | 117e7bfbcdbf15349873910cd210d9c05a54b0e5e20c6c3fd28e2f6f930d85cb | 30.367257 | 112 | 0.631683 | 3.944908 | false | false | false | false |
andrewyng/aisuite | aisuite/providers/azure_provider.py | 5,389 | 0 | MIT License | import urllib.request
import json
import os
from aisuite.provider import Provider
from aisuite.framework import ChatCompletionResponse
from aisuite.framework.message import Message, ChatCompletionMessageToolCall, Function
# Azure provider is based on the documentation here -
# https://learn.microsoft.com/en-us/azure/... | 1,283 | bb77d5901c84d67cd902db73b9b6d664b69f96c21a326b96fdde55c4cec92a4e | 38.625 | 160 | 0.641492 | 4.200312 | false | false | false | false |
abus-aikorea/voice-pro | cosyvoice/hifigan/hifigan.py | 3,231 | 0 | MIT License | from typing import Dict, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from matcha.hifigan.models import feature_loss, generator_loss, discriminator_loss
from cosyvoice.utils.losses import tpr_loss, mel_loss
class HiFiGan(nn.Module):
def __init__(self, generator, discriminator, mel_s... | 980 | 716181c498e85d58bdcb09d9b079a52d38a73aa18df3b9bc582c4e4015e91d3e | 47.223881 | 135 | 0.626741 | 3.296939 | false | false | false | false |
microsoft/TRELLIS | dataset_toolkits/render.py | 4,987 | 0 | MIT License | import os
import json
import copy
import sys
import importlib
import argparse
import pandas as pd
from easydict import EasyDict as edict
from functools import partial
from subprocess import DEVNULL, call
import numpy as np
from utils import sphere_hammersley_sequence
BLENDER_LINK = 'https://download.blender.org/relea... | 1,468 | 2eb4df7f64c1afeb37a4a24fecb5022caab25d165163f937a684650ce71b1df5 | 40.214876 | 132 | 0.63465 | 3.397139 | false | false | false | false |
virattt/ai-hedge-fund | src/agents/risk_manager.py | 3,134 | 0 | MIT License | from langchain_core.messages import HumanMessage
from graph.state import AgentState, show_agent_reasoning
from utils.progress import progress
from tools.api import get_prices, prices_to_df
import json
##### Risk Management Agent #####
def risk_management_agent(state: AgentState):
"""Controls position sizing based... | 755 | 0d385b11ce5d2ed419046e28178e23589399756435c42ab1ef58233b214d7537 | 36.759036 | 146 | 0.638162 | 4.150993 | false | false | false | false |
mannaandpoem/OpenManus | app/prompt/mcp.py | 2,168 | 0 | MIT License | """Prompts for the MCP Agent."""
SYSTEM_PROMPT = """You are an AI assistant with access to a Model Context Protocol (MCP) server.
You can use the tools provided by the MCP server to complete tasks.
The MCP server will dynamically expose tools that you can use - always check the available tools first.
When using an MC... | 489 | 2895060dbaccfb7ff99aacbad3eaca1cc95a6cc03789b36fff3d473077158f76 | 49.418605 | 140 | 0.788284 | 4.433538 | false | false | false | false |
openai/openai-agents-python | src/agents/mcp/server.py | 11,269 | 0 | MIT License | from __future__ import annotations
import abc
import asyncio
from contextlib import AbstractAsyncContextManager, AsyncExitStack
from pathlib import Path
from typing import Any, Literal
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
from mcp import ClientSession, StdioServerParamete... | 2,590 | 5c7447b73641d615b024ab62f85417efcbb14c71734ed5e18f27b28ba4e440c0 | 36.438538 | 100 | 0.630934 | 4.350965 | false | false | false | false |
HKUDS/LightRAG | examples/lightrag_lmdeploy_demo.py | 3,084 | 0 | MIT License | import os
from lightrag import LightRAG, QueryParam
from lightrag.llm.lmdeploy import lmdeploy_model_if_cache
from lightrag.llm.hf import hf_embed
from lightrag.utils import EmbeddingFunc
from transformers import AutoModel, AutoTokenizer
from lightrag.kg.shared_storage import initialize_pipeline_status
import asyncio... | 830 | 7060bfe8585221b8f13ecb15228e23d63e2b7f0675006386af836aa432d8e1f8 | 27.036364 | 102 | 0.613489 | 3.715663 | false | false | false | false |
trycua/cua | libs/agent/agent/providers/omni/tools/bash.py | 2,241 | 0 | MIT License | """Bash tool for Omni provider."""
import logging
from typing import Any, Dict
from computer import Computer
from ....core.tools import ToolResult, ToolError
from .base import BaseOmniTool
logger = logging.getLogger(__name__)
class BashTool(BaseOmniTool):
"""Tool for executing bash commands."""
name = "ba... | 447 | 4b360f31416828784b743e168c5f6a6c5bc07795114d25933dd3d68da0f6af28 | 29.283784 | 93 | 0.525658 | 5.013423 | false | false | false | false |
docling-project/docling | docling/cli/models.py | 3,979 | 0 | MIT License | import logging
import warnings
from enum import Enum
from pathlib import Path
from typing import Annotated, Optional
import typer
from rich.console import Console
from rich.logging import RichHandler
from docling.datamodel.settings import settings
from docling.utils.model_downloader import download_models
warnings.f... | 1,044 | 4bf25380ce323f6d78a58d8015a32d760c07c01b890bbbc5141d4a998e113809 | 29.374046 | 119 | 0.624277 | 3.811303 | false | false | false | false |
pydantic/pydantic-ai | pydantic_graph/pydantic_graph/nodes.py | 7,441 | 0 | MIT License | from __future__ import annotations as _annotations
import copy
from abc import ABC, abstractmethod
from dataclasses import dataclass, is_dataclass
from functools import cache
from typing import Any, ClassVar, Generic, get_type_hints
from uuid import uuid4
from typing_extensions import Never, Self, TypeVar, get_origin... | 1,940 | 04547dc2906c3c2e41966a5628c3be271f8d2add12e9cf50ce7a62fc2ac5111d | 35.121359 | 116 | 0.628276 | 3.835567 | false | false | false | false |
microsoft/TRELLIS | app.py | 15,010 | 0 | MIT License | import gradio as gr
from gradio_litmodel3d import LitModel3D
import os
import shutil
from typing import *
import torch
import numpy as np
import imageio
from easydict import EasyDict as edict
from PIL import Image
from trellis.pipelines import TrellisImageTo3DPipeline
from trellis.representations import Gaussian, Mesh... | 4,028 | 8cc8961079862042896c7772129e44dd212fc2a654606b810238afd334ee958d | 36.245658 | 220 | 0.60473 | 3.726415 | false | false | false | false |
HKUDS/LightRAG | lightrag/kg/qdrant_impl.py | 12,731 | 0 | MIT License | import asyncio
import os
from typing import Any, final, List
from dataclasses import dataclass
import numpy as np
import hashlib
import uuid
from ..utils import logger
from ..base import BaseVectorStorage
import configparser
import pipmaster as pm
if not pm.is_installed("qdrant-client"):
pm.install("qdrant-client"... | 2,865 | 94c25e4ff17b4b8a1e725088b7b1e2afa96e3ce2e9965b3a49a5b345701eb570 | 33.975275 | 96 | 0.548347 | 4.44363 | false | false | false | false |
pydantic/pydantic-ai | tests/typed_graph.py | 3,602 | 0 | MIT License | from __future__ import annotations as _annotations
from dataclasses import dataclass
from typing import Any
from typing_extensions import assert_type
from pydantic_graph import BaseNode, End, FullStatePersistence, Graph, GraphRunContext
from pydantic_graph.persistence import BaseStatePersistence
@dataclass
class F... | 1,188 | d0d41101e0e18fe9e72dbd128cd72fdd07764e9508206f93cfcf7ef399e396bc | 24.013889 | 101 | 0.664908 | 3.031987 | false | false | false | false |
openai/openai-agents-python | src/agents/mcp/util.py | 5,232 | 0 | MIT License | import functools
import json
from typing import TYPE_CHECKING, Any
from agents.strict_schema import ensure_strict_json_schema
from .. import _debug
from ..exceptions import AgentsException, ModelBehaviorError, UserError
from ..logger import logger
from ..run_context import RunContextWrapper
from ..tool import Functio... | 1,301 | 3b9b5eaae075d2473dafbdc33c8c6f22618c291f4db71d14acf72e00efcff2cb | 37.470588 | 99 | 0.600344 | 4.021522 | false | false | false | false |
infinition/Bjorn | resources/waveshare_epd/epd2in7.py | 18,685 | 0 | MIT License | # *****************************************************************************
# * | File : epd2in7.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : py... | 6,451 | e523610daafa017173588d352c9bf44eb84bc8e48f87ced1259781b23df1dd47 | 34.455408 | 170 | 0.510035 | 2.89645 | false | false | false | false |
browser-use/browser-use | examples/integrations/slack/slack_example.py | 1,359 | 0 | MIT License | import os
from dotenv import load_dotenv
from langchain_google_genai import ChatGoogleGenerativeAI
from pydantic import SecretStr
from browser_use import BrowserConfig
from examples.integrations.slack.slack_api import SlackBot, app
load_dotenv()
# load credentials from environment variables
bot_token = os.getenv('S... | 435 | 2972c252bf780263e35a636f12f3b23ee0f9c952a752b149f63a8014cb7ff23f | 31.357143 | 102 | 0.762325 | 3.124138 | false | true | false | false |
meta-llama/llama-stack | llama_stack/models/llama/llama4/vision/embedding.py | 7,179 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import math
from typing import Any, Callable, Dict, List
import torch
import torch.nn as nn
import torch.nn.functional... | 2,050 | 405100c809fa894ed002903f616445228e550bec387d84757540a3bde69bde1e | 33.349282 | 121 | 0.592562 | 3.501951 | false | false | false | false |
deepseek-ai/DeepSeek-VL2 | deepseek_vl2/models/conversation.py | 10,087 | 0 | MIT License | """
From https://github.com/lm-sys/FastChat/blob/main/fastchat/conversation.py
"""
import dataclasses
from enum import IntEnum, auto
from typing import Any, Dict, List
class SeparatorStyle(IntEnum):
"""Separator styles."""
DeepSeek = auto()
DeepSeekV2 = auto()
PLAIN = auto()
ALIGNMENT = auto()
... | 2,690 | a1be46cdbb841bb6ef20cbb83e6735096ecc9c92a2044941f6aa513e9342b3f0 | 31.53871 | 134 | 0.536334 | 3.749814 | false | false | false | false |
microsoft/markitdown | packages/markitdown/src/markitdown/converters/_llm_caption.py | 1,450 | 0 | MIT License | from typing import BinaryIO, Any, Union
import base64
import mimetypes
from .._stream_info import StreamInfo
def llm_caption(
file_stream: BinaryIO, stream_info: StreamInfo, *, client, model, prompt=None
) -> Union[None, str]:
if prompt is None or prompt.strip() == "":
prompt = "Write a detailed capti... | 365 | 2b7677b538a51f631499361ec79c39e15c3cff19ae278c5d479e98853f56997c | 28 | 88 | 0.562069 | 3.972603 | false | false | false | false |
browser-use/browser-use | browser_use/controller/service.py | 33,976 | 0 | MIT License | import asyncio
import datetime
import enum
import json
import logging
import re
from typing import Dict, Generic, Optional, Tuple, Type, TypeVar, cast
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.prompts import PromptTemplate
from playwright.async_api import ElementHandle, P... | 9,999 | 6ca511d3defd5e4d3c24ad7ebc8b74065e81c83269d3df7de61c88ad2517bdae | 36.542541 | 282 | 0.683306 | 3.39794 | false | false | false | false |
meta-llama/llama-stack | llama_stack/models/llama/llama4/prompts.py | 14,355 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import textwrap
from io import BytesIO
from pathlib import Path
from typing import List
from ..datatypes import RawMed... | 2,883 | cd4a89caf82934c23b0f0bb92af2d64428d5e349d1a91d5d442e2c8fe15dbbd8 | 45.911765 | 692 | 0.514246 | 4.979188 | false | false | false | false |
trycua/cua | libs/agent/agent/core/experiment.py | 8,866 | 0 | MIT License | """Core experiment management for agents."""
import os
import logging
import base64
from io import BytesIO
from datetime import datetime
from typing import Any, Dict, List, Optional
from PIL import Image
import json
import re
logger = logging.getLogger(__name__)
class ExperimentManager:
"""Manages experiment di... | 2,006 | fa688c907f889b485dfa63432c692c6d2c9d8b235563b2e39e008a7a1af5e1c9 | 34.606426 | 102 | 0.564516 | 4.419741 | false | false | false | false |
MadcowD/ell | src/ell/types/_lstr.py | 22,425 | 0 | MIT License | """
LM string that supports logits and keeps track of it'sorigin_trace even after mutation.
"""
import numpy as np
from typing import (
Optional,
Set,
SupportsIndex,
Union,
FrozenSet,
Iterable,
List,
Tuple,
Any,
Callable,
)
from typing_extensions import override
from pydantic im... | 5,364 | d860c5710ae89353cc2e621066f5facf5ec816adbb6a893facdb65a529d83a48 | 40.682156 | 357 | 0.611014 | 4.180649 | false | false | false | false |
MadcowD/ell | src/ell/util/serialization.py | 5,626 | 0 | MIT License |
# Global converter
import base64
from datetime import datetime, timezone
import hashlib
from io import BytesIO
import json
import cattrs
import numpy as np
from pydantic import BaseModel
import PIL
from ell.types._lstr import _lstr
pydantic_ltype_aware_cattr = cattrs.Converter()
def serialize_image(img):
buffer... | 1,524 | 4306084ce2c4b20662dc7a0f9c6c076f2f0d684f1fee3a90e1c8cd2cfa7385f6 | 30.965909 | 205 | 0.665837 | 3.691601 | false | false | false | false |
fudan-generative-vision/hallo2 | basicsr/utils/img_util.py | 6,138 | 0 | MIT License | import cv2
import math
import numpy as np
import os
import torch
from torchvision.utils import make_grid
def img2tensor(imgs, bgr2rgb=True, float32=True):
"""Numpy array to tensor.
Args:
imgs (list[ndarray] | ndarray): Input images.
bgr2rgb (bool): Whether to change bgr to rgb.
float3... | 1,809 | 21abd26f0a267f522f451265d90e6ba41860f681257ea7be013cd73598de2ae6 | 34.900585 | 116 | 0.591398 | 3.393035 | false | false | false | false |
fudan-generative-vision/hallo2 | basicsr/utils/realesrgan_utils.py | 12,264 | 0 | MIT License | import cv2
import math
import numpy as np
import os
import queue
import threading
import torch
from torch.nn import functional as F
from basicsr.utils.download_util import load_file_from_url
from basicsr.utils.misc import get_device
# ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
class RealES... | 3,302 | 7b7f3f5d5c27d0291ffb4c3cd952910164b50ecbb07383efd342741cd8e4782c | 39.612583 | 118 | 0.531148 | 3.714113 | false | false | false | false |
HKUDS/AutoAgent | autoagent/agents/math/vote_aggregator_agent.py | 1,355 | 0 | MIT License | from autoagent.types import Agent
from autoagent.registry import register_plugin_agent
@register_plugin_agent(name="Vote Aggregator Agent", func_name="get_vote_aggregator_agent")
def get_vote_aggregator_agent(model: str):
'''
This agent aggregates solutions from different solvers and determines the final answ... | 317 | 1dde59bb87d47dd87f9549ec20de03aaac07b3c91b8753d6baecdd321b31f015 | 78.705882 | 874 | 0.795572 | 4.274448 | false | false | false | false |
MadcowD/ell | x/openai_realtime/examples/chat_assistant_clone.py | 6,697 | 0 | MIT License | import asyncio
import base64
import os
import numpy as np
import sounddevice as sd
from openai_realtime import RealtimeClient, RealtimeUtils
from typing import Optional, Callable
class RealtimeAssistant:
def __init__(self, api_key: str, instructions: str, debug: bool = False):
self.api_key = api_key
... | 1,631 | 6471b81554f42025f34874bc58ff77a45a9b37d518d210520dd102072db31723 | 42.212903 | 578 | 0.606988 | 4.10607 | false | false | false | false |
meta-llama/llama-stack | llama_stack/models/llama/llama3_2/prompts_vision.py | 5,524 | 0 | MIT License | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import textwrap
from pathlib import Path
from llama_stack.models.llama.datatypes import (
RawMediaItem,
RawMes... | 1,247 | 8fe36cb43a428b214b2af63b306866b44427697b8f89f67a1d810407554884f5 | 42.84127 | 197 | 0.546343 | 4.429832 | false | false | false | false |
browser-use/web-ui | webui.py | 46,747 | 0 | MIT License | import pdb
import logging
from dotenv import load_dotenv
load_dotenv()
import os
import glob
import asyncio
import argparse
import os
logger = logging.getLogger(__name__)
import gradio as gr
import inspect
from functools import wraps
from browser_use.agent.service import Agent
from playwright.async_api import asyn... | 10,405 | fd2db2e8e4e8e0c963a75973337bf92eb962b8aa11d1537fe800196257e8cc11 | 37.955833 | 395 | 0.49969 | 4.492744 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.