repo_full_name
stringlengths
6
93
repo_url
stringlengths
25
112
repo_api_url
stringclasses
28 values
owner
stringclasses
28 values
repo_name
stringclasses
28 values
description
stringclasses
28 values
stars
int64
617
98.8k
forks
int64
31
355
watchers
int64
990
999
license
stringclasses
2 values
default_branch
stringclasses
2 values
repo_created_at
timestamp[s]date
2012-07-24 23:12:50
2025-06-16 08:07:28
repo_updated_at
timestamp[s]date
2026-02-23 15:23:15
2026-05-03 18:52:12
repo_topics
listlengths
0
13
repo_languages
unknown
is_fork
bool
1 class
open_issues
int64
3
104
file_path
stringlengths
3
208
file_name
stringclasses
509 values
file_extension
stringclasses
1 value
file_size_bytes
int64
101
84k
file_url
stringclasses
627 values
file_raw_url
stringclasses
627 values
file_sha
stringclasses
624 values
language
stringclasses
8 values
parsed_at
stringdate
2026-05-04 01:12:36
2026-05-04 19:41:55
text
stringlengths
100
102k
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/components/hotreload.py
null
null
null
null
null
null
Python
2026-05-04T02:26:19.834022
import pickle, os import logging import requests from ..config import VERSION from ..returnvalues import ReturnValue from ..storage import templates from .contact import update_local_chatrooms, update_local_friends from .messages import produce_msg logger = logging.getLogger('itchat') def load_hotreloa...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/components/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:19.844377
from .contact import load_contact from .hotreload import load_hotreload from .login import load_login from .messages import load_messages from .register import load_register def load_components(core): load_contact(core) load_hotreload(core) load_login(core) load_messages(core) load_regis...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/components/login.py
null
null
null
null
null
null
Python
2026-05-04T02:26:19.845441
import os, time, re, io import threading import json, xml.dom.minidom import random import traceback, logging try: from httplib import BadStatusLine except ImportError: from http.client import BadStatusLine import requests from pyqrcode import QRCode from .. import config, utils from ..returnval...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/components/messages.py
null
null
null
null
null
null
Python
2026-05-04T02:26:19.846193
import os, time, re, io import json import mimetypes, hashlib import logging from collections import OrderedDict import requests from .. import config, utils from ..returnvalues import ReturnValue from ..storage import templates from .contact import update_local_uin logger = logging.getLogger('itchat') def load_mes...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/storage/templates.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.438935
import logging, copy, pickle from weakref import ref from ..returnvalues import ReturnValue from ..utils import update_info_dict logger = logging.getLogger('itchat') class AttributeDict(dict): def __getattr__(self, value): keyName = value[0].upper() + value[1:] try: return...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/core.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.444841
import requests from . import storage from .components import load_components class Core(object): def __init__(self): ''' init is the only method defined in core.py alive is value showing whether core is running - you should call logout method to change it ...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/storage/messagequeue.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.445416
import logging try: import Queue as queue except ImportError: import queue from .templates import AttributeDict logger = logging.getLogger('itchat') class Queue(queue.Queue): def put(self, message): queue.Queue.put(self, Message(message)) class Message(AttributeDict): def down...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/log.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.448238
import logging class LogSystem(object): handlerList = [] showOnCmd = True loggingLevel = logging.INFO loggingFile = None def __init__(self): self.logger = logging.getLogger('itchat') self.logger.addHandler(logging.NullHandler()) self.logger.setLevel(self.loggingLev...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/returnvalues.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.462628
#coding=utf8 TRANSLATE = 'Chinese' class ReturnValue(dict): ''' turn return value of itchat into a boolean value for requests: ..code::python import requests r = requests.get('http://httpbin.org/get') print(ReturnValue(rawResponse=r) for normal ...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/storage/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.463564
import os, time, copy from threading import Lock from .messagequeue import Queue from .templates import ( ContactList, AbstractUserDict, User, MassivePlatform, Chatroom, ChatroomMember) def contact_change(fn): def _contact_change(core, *args, **kwargs): with core.storageClass.updateLock:...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
itchat/utils.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.464144
import re, os, sys, subprocess, copy, traceback, logging try: from HTMLParser import HTMLParser except ImportError: from html.parser import HTMLParser try: from urllib import quote as _quote quote = lambda n: _quote(n.encode('utf8', 'replace')) except ImportError: from urllib.parse import...
littlecodersh/ItChat
https://github.com/littlecodersh/ItChat
null
null
null
null
26,493
null
null
mit
null
null
null
null
null
null
null
setup.py
null
null
null
null
null
null
Python
2026-05-04T02:26:20.464970
""" A wechat personal account api project See: https://github.com/littlecodersh/ItChat """ from setuptools import setup, find_packages from codecs import open from os import path import itchat here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_descri...
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
examples/agentic_vectorless_rag_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:26:24.436885
""" Agentic Vectorless RAG with PageIndex - Demo A simple example of building a document QA agent with self-hosted PageIndex and the OpenAI Agents SDK. Instead of vector similarity search and chunking, PageIndex builds a hierarchical tree index and uses agentic LLM reasoning for human-like, context-aware retrieval. A...
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
pageindex/client.py
null
null
null
null
null
null
Python
2026-05-04T02:26:24.437472
import os import uuid import json import asyncio import concurrent.futures from pathlib import Path import PyPDF2 from .page_index import page_index from .page_index_md import md_to_tree from .retrieve import get_document, get_document_structure, get_page_content from .utils import ConfigLoader, remove_fields META_I...
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
pageindex/page_index_md.py
null
null
null
null
null
null
Python
2026-05-04T02:26:24.438009
import asyncio import json import re import os try: from .utils import * except: from utils import * async def get_node_summary(node, summary_token_threshold=200, model=None): node_text = node.get('text') num_tokens = count_tokens(node_text, model=model) if num_tokens < summary_token_threshold: ...
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
pageindex/utils.py
null
null
null
null
null
null
Python
2026-05-04T02:26:24.438775
import litellm import logging import os import textwrap from datetime import datetime import time import json import PyPDF2 import copy import asyncio import pymupdf from io import BytesIO from dotenv import load_dotenv load_dotenv() import logging import yaml from pathlib import Path from types import SimpleNamespace ...
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
pageindex/page_index.py
null
null
null
null
null
null
Python
2026-05-04T02:26:24.439248
import os import json import copy import math import random import re from .utils import * import os from concurrent.futures import ThreadPoolExecutor, as_completed ################### check title in page ######################################################### async def check_title_appearance(item, page_list, start...
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
pageindex/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:24.708182
from .page_index import * from .page_index_md import md_to_tree from .retrieve import get_document, get_document_structure, get_page_content from .client import PageIndexClient
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
run_pageindex.py
null
null
null
null
null
null
Python
2026-05-04T02:26:24.779470
import argparse import os import json from pageindex import * from pageindex.page_index_md import md_to_tree from pageindex.utils import ConfigLoader if __name__ == "__main__": # Set up argument parser parser = argparse.ArgumentParser(description='Process PDF or Markdown document and generate structure') p...
VectifyAI/PageIndex
https://github.com/VectifyAI/PageIndex
null
null
null
null
26,086
null
null
mit
null
null
null
null
null
null
null
pageindex/retrieve.py
null
null
null
null
null
null
Python
2026-05-04T02:26:25.172858
import json import PyPDF2 try: from .utils import get_number_of_pages, remove_fields except ImportError: from utils import get_number_of_pages, remove_fields # ── Helpers ────────────────────────────────────────────────────────────────── def _parse_pages(pages: str) -> list[int]: """Parse a pages string...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/agents_as_tools.py
null
null
null
null
null
null
Python
2026-05-04T02:26:29.460193
import asyncio from agents import Agent, ItemHelpers, MessageOutputItem, Runner, trace from examples.auto_mode import input_with_fallback """ This example shows the agents-as-tools pattern. The frontline agent receives a user message and then picks which agents to call, as tools. In this case, it picks from a set of ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
.github/scripts/select-release-milestone.py
null
null
null
null
null
null
Python
2026-05-04T02:26:29.461783
#!/usr/bin/env python3 from __future__ import annotations import argparse import json import os import re import subprocess import sys from urllib import error, request def warn(message: str) -> None: print(message, file=sys.stderr) def parse_version(value: str | None) -> tuple[int, int, int] | None: if no...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:29.464099
# Make the examples directory into a package to avoid top-level module name collisions. # This is needed so that mypy treats files like examples/customer_service/main.py and # examples/researcher_app/main.py as distinct modules rather than both named "main".
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
.agents/skills/runtime-behavior-probe/templates/python_probe.py
null
null
null
null
null
null
Python
2026-05-04T02:26:29.465269
"""Disposable Python probe scaffold. Copy this file to a temporary location and adapt it for one narrow question. Recommended usage from the repository root: uv run python /tmp/probe.py If you want structured artifacts for repeat-heavy or benchmark probes: PROBE_OUTPUT_DIR=/tmp/probe-run uv run python /tmp/...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
docs/scripts/translate_docs.py
null
null
null
null
null
null
Python
2026-05-04T02:26:29.472185
# ruff: noqa import os import sys import argparse import subprocess from pathlib import Path from openai import OpenAI from concurrent.futures import ThreadPoolExecutor # import logging # logging.basicConfig(level=logging.INFO) # logging.getLogger("openai").setLevel(logging.DEBUG) OPENAI_MODEL = os.environ.get("OPENA...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
.codex/hooks/stop_repo_tidy.py
null
null
null
null
null
null
Python
2026-05-04T02:26:29.474877
#!/usr/bin/env python3 from __future__ import annotations import hashlib import json import subprocess import sys import tempfile from dataclasses import asdict, dataclass from pathlib import Path MAX_RUFF_FIX_FILES = 20 PYTHON_SUFFIXES = {".py", ".pyi"} @dataclass class HookState: last_tidy_fingerprint: str |...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/agents_as_tools_conditional.py
null
null
null
null
null
null
Python
2026-05-04T02:26:29.878977
import asyncio from pydantic import BaseModel from agents import Agent, AgentBase, ModelSettings, RunContextWrapper, Runner, trace from agents.tool import function_tool from examples.auto_mode import confirm_with_fallback, input_with_fallback """ This example demonstrates the agents-as-tools pattern with conditional...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/agents_as_tools_streaming.py
null
null
null
null
null
null
Python
2026-05-04T02:26:30.371264
import asyncio from agents import Agent, AgentToolStreamEvent, ModelSettings, Runner, function_tool, trace @function_tool( name_override="billing_status_checker", description_override="Answer questions about customer billing status.", ) def billing_status_checker(customer_id: str | None = None, question: str...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/human_in_the_loop_custom_rejection.py
null
null
null
null
null
null
Python
2026-05-04T02:26:30.715428
"""Human-in-the-loop example with a custom rejection message. This example is intentionally minimal: 1. A single sensitive tool requires human approval. 2. The first turn always issues that tool call. 3. ``tool_error_formatter`` defines the universal fallback message shape. 4. A per-call ``rejection_message`` passed t...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/human_in_the_loop.py
null
null
null
null
null
null
Python
2026-05-04T02:26:30.716061
"""Human-in-the-loop example with tool approval. This example demonstrates how to: 1. Define tools that require approval before execution 2. Handle interruptions when tool approval is needed 3. Serialize/deserialize run state to continue execution later 4. Approve or reject tool calls based on user input """ import a...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
.github/scripts/pr_labels.py
null
null
null
null
null
null
Python
2026-05-04T02:26:30.806522
#!/usr/bin/env python3 from __future__ import annotations import argparse import json import os import pathlib import subprocess import sys from collections.abc import Sequence from dataclasses import dataclass from typing import Any, Final ALLOWED_LABELS: Final[set[str]] = { "documentation", "project", "...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/llm_as_a_judge.py
null
null
null
null
null
null
Python
2026-05-04T02:26:30.941685
from __future__ import annotations import asyncio from dataclasses import dataclass from typing import Literal from agents import Agent, ItemHelpers, Runner, TResponseInputItem, trace from examples.auto_mode import input_with_fallback, is_auto_mode """ This example shows the LLM as a judge pattern. The first agent g...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/parallelization.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.311785
import asyncio from agents import Agent, ItemHelpers, Runner, trace from examples.auto_mode import input_with_fallback """ This example shows the parallelization pattern. We run the agent three times in parallel, and pick the best result. """ spanish_agent = Agent( name="spanish_agent", instructions="You tra...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/output_guardrails.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.313049
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...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
docs/scripts/generate_ref_files.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.350339
#!/usr/bin/env python """ generate_ref_files.py Create missing Markdown reference stubs for mkdocstrings. Usage: python scripts/generate_ref_files.py """ from pathlib import Path # ---- Paths ----------------------------------------------------------- REPO_ROOT = Path(__file__).resolve().parent.parent.parent ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/agents_as_tools_structured.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.373782
import asyncio from pydantic import BaseModel, Field from agents import Agent, Runner """ This example shows structured input for agent-as-tool calls. """ class TranslationInput(BaseModel): text: str = Field(description="Text to translate.") source: str = Field(description="Source language code or name.") ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/routing.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.393470
import asyncio import uuid from openai.types.responses import ResponseContentPartDoneEvent, ResponseTextDeltaEvent from agents import Agent, RawResponsesStreamEvent, Runner, TResponseInputItem, trace from examples.auto_mode import input_with_fallback, is_auto_mode """ This example shows the handoffs/routing pattern....
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/forcing_tool_use.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.462001
from __future__ import annotations import asyncio from typing import Any, Literal from pydantic import BaseModel from agents import ( Agent, FunctionToolResult, ModelSettings, RunContextWrapper, Runner, ToolsToFinalOutputFunction, ToolsToFinalOutputResult, function_tool, ) from exampl...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/deterministic.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.480298
import asyncio from pydantic import BaseModel from agents import Agent, Runner, trace from examples.auto_mode import input_with_fallback """ This example demonstrates a deterministic flow, where each step is performed by an agent. 1. The first agent generates a story outline 2. We feed the outline into the second ag...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/human_in_the_loop_stream.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.504128
"""Human-in-the-loop example with streaming. This example demonstrates the human-in-the-loop (HITL) pattern with streaming. The agent will pause execution when a tool requiring approval is called, allowing you to approve or reject the tool call before continuing. The streaming version provides real-time feedback as t...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/streaming_guardrails.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.557252
from __future__ import annotations import asyncio from openai.types.responses import ResponseTextDeltaEvent from pydantic import BaseModel, Field from agents import Agent, Runner """ This example shows how to use guardrails as the model is streaming. Output guardrails run after the final output has been generated; ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/agent_lifecycle_example.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.875508
import asyncio import random from typing import Any from pydantic import BaseModel from agents import ( Agent, AgentHookContext, AgentHooks, RunContextWrapper, Runner, Tool, function_tool, ) from examples.auto_mode import input_with_fallback, is_auto_mode class CustomAgentHooks(AgentHook...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/auto_mode.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.878703
"""Utilities for running examples in automated mode. When ``EXAMPLES_INTERACTIVE_MODE=auto`` is set, these helpers provide deterministic inputs and confirmations so examples can run without manual interaction. The helpers are intentionally lightweight to avoid adding dependencies to example code. """ from __future__ ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/dynamic_system_prompt.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.947591
import asyncio import random from dataclasses import dataclass from typing import Literal from agents import Agent, RunContextWrapper, Runner @dataclass class CustomContext: style: Literal["haiku", "pirate", "robot"] def custom_instructions( run_context: RunContextWrapper[CustomContext], agent: Agent[Custo...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/hello_world.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.966714
import asyncio from agents import Agent, Runner async def main(): agent = Agent( name="Assistant", instructions="You only respond in haikus.", ) result = await Runner.run(agent, "Tell me about recursion in programming.") print(result.final_output) # Function calls itself, # L...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/hello_world_gpt_5.py
null
null
null
null
null
null
Python
2026-05-04T02:26:31.986820
import asyncio from openai.types.shared import Reasoning from agents import Agent, ModelSettings, Runner # If you have a certain reason to use Chat Completions, you can configure the model this way, # and then you can pass the chat_completions_model to the Agent constructor. # from openai import AsyncOpenAI # client...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/hello_world_gpt_oss.py
null
null
null
null
null
null
Python
2026-05-04T02:26:32.059303
import asyncio from openai import AsyncOpenAI from agents import Agent, OpenAIChatCompletionsModel, Runner, set_tracing_disabled set_tracing_disabled(True) # import logging # logging.basicConfig(level=logging.DEBUG) # This is an example of how to use gpt-oss with Ollama. # Refer to https://cookbook.openai.com/arti...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/image_tool_output.py
null
null
null
null
null
null
Python
2026-05-04T02:26:32.060454
import asyncio from agents import Agent, Runner, ToolOutputImage, ToolOutputImageDict, function_tool return_typed_dict = True URL = "https://images.unsplash.com/photo-1505761671935-60b3a7427bad?auto=format&fit=crop&w=400&q=80" @function_tool def fetch_random_image() -> ToolOutputImage | ToolOutputImageDict: ""...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/local_file.py
null
null
null
null
null
null
Python
2026-05-04T02:26:32.442707
import asyncio import base64 import os from agents import Agent, Runner FILEPATH = os.path.join(os.path.dirname(__file__), "media/partial_o3-and-o4-mini-system-card.pdf") def file_to_base64(file_path: str) -> str: with open(file_path, "rb") as f: return base64.b64encode(f.read()).decode("utf-8") async...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/lifecycle_example.py
null
null
null
null
null
null
Python
2026-05-04T02:26:32.444347
import asyncio import random from typing import Any, cast from pydantic import BaseModel from agents import ( Agent, AgentHookContext, AgentHooks, RunContextWrapper, RunHooks, Runner, Tool, Usage, function_tool, ) from agents.items import ModelResponse, TResponseInputItem from agen...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/previous_response_id.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.256370
import asyncio from agents import Agent, Runner from examples.auto_mode import input_with_fallback, is_auto_mode """This demonstrates usage of the `previous_response_id` parameter to continue a conversation. The second run passes the previous response ID to the model, which allows it to continue the conversation with...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/local_image.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.257980
import asyncio import base64 import os from agents import Agent, Runner FILEPATH = os.path.join(os.path.dirname(__file__), "media/image_bison.jpg") def image_to_base64(image_path): with open(image_path, "rb") as image_file: encoded_string = base64.b64encode(image_file.read()).decode("utf-8") return ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/non_strict_output_type.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.287117
import asyncio import json from dataclasses import dataclass from typing import Any from agents import Agent, AgentOutputSchema, AgentOutputSchemaBase, Runner """This example demonstrates how to use an output type that is not in strict mode. Strict mode allows us to guarantee valid JSON output, but some schemas are n...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/prompt_template.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.426640
import argparse import asyncio import random from agents import Agent, GenerateDynamicPromptData, Runner """ NOTE: This example will not work out of the box, because the default prompt ID will not be available in your project. To use it, please: 1. Go to https://platform.openai.com/playground/prompts 2. Create a new...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/remote_pdf.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.427875
import asyncio from agents import Agent, Runner URL = "https://www.berkshirehathaway.com/letters/2024ltr.pdf" async def main(): agent = Agent( name="Assistant", instructions="You are a helpful assistant.", ) result = await Runner.run( agent, [ { ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/retry.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.438251
import asyncio import inspect from agents import ( Agent, ModelRetrySettings, ModelSettings, RetryDecision, RunConfig, Runner, retry_policies, ) def format_error(error: object) -> str: if not isinstance(error, BaseException): return "Unknown error" return str(error) or err...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/stream_function_call_args.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.962717
import asyncio from typing import Annotated, Any from openai.types.responses import ResponseFunctionCallArgumentsDeltaEvent from agents import Agent, Runner, function_tool @function_tool def write_file(filename: Annotated[str, "Name of the file"], content: str) -> str: """Write content to a file.""" return ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/retry_litellm.py
null
null
null
null
null
null
Python
2026-05-04T02:26:33.963903
import asyncio import inspect from agents import ( Agent, ModelRetrySettings, ModelSettings, RetryDecision, RunConfig, Runner, retry_policies, ) def format_error(error: object) -> str: if not isinstance(error, BaseException): return "Unknown error" return str(error) or err...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/stream_ws.py
null
null
null
null
null
null
Python
2026-05-04T02:26:34.317613
"""Responses websocket streaming example with function tools, agent-as-tool, and approval. This example shows a user-facing websocket workflow using `responses_websocket_session(...)`: - Streaming output (including reasoning summary deltas when available) - Regular function tools - An `Agent.as_tool(...)` specialist a...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/tools.py
null
null
null
null
null
null
Python
2026-05-04T02:26:34.389686
import asyncio from typing import Annotated from pydantic import BaseModel, Field from agents import Agent, Runner, function_tool class Weather(BaseModel): city: str = Field(description="The city name") temperature_range: str = Field(description="The temperature range in Celsius") conditions: str = Fiel...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/usage_tracking.py
null
null
null
null
null
null
Python
2026-05-04T02:26:34.413105
import asyncio from pydantic import BaseModel from agents import Agent, Runner, Usage, function_tool class Weather(BaseModel): city: str temperature_range: str conditions: str @function_tool def get_weather(city: str) -> Weather: """Get the current weather information for a specified city.""" ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/tool_guardrails.py
null
null
null
null
null
null
Python
2026-05-04T02:26:34.429271
import asyncio import json from agents import ( Agent, Runner, ToolGuardrailFunctionOutput, ToolInputGuardrailData, ToolOutputGuardrailData, ToolOutputGuardrailTripwireTriggered, function_tool, tool_input_guardrail, tool_output_guardrail, ) @function_tool def send_email(to: str, s...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/customer_service/main.py
null
null
null
null
null
null
Python
2026-05-04T02:26:34.563714
from __future__ import annotations as _annotations import asyncio import random import uuid from pydantic import BaseModel from agents import ( Agent, HandoffOutputItem, ItemHelpers, MessageOutputItem, RunContextWrapper, Runner, ToolCallItem, ToolCallOutputItem, TResponseInputItem...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/stream_items.py
null
null
null
null
null
null
Python
2026-05-04T02:26:35.001869
import asyncio import random from agents import Agent, ItemHelpers, Runner, function_tool @function_tool def how_many_jokes() -> int: """Return a random integer of jokes to tell between 1 and 10 (inclusive).""" return random.randint(1, 10) async def main(): agent = Agent( name="Joker", ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/financial_research_agent/agents/financials_agent.py
null
null
null
null
null
null
Python
2026-05-04T02:26:35.004086
from pydantic import BaseModel from agents import Agent # A sub‑agent focused on analyzing a company's fundamentals. FINANCIALS_PROMPT = ( "You are a financial analyst focused on company fundamentals such as revenue, " "profit, margins and growth trajectory. Given a collection of web (and optional file) " ...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/stream_text.py
null
null
null
null
null
null
Python
2026-05-04T02:26:35.014358
import asyncio from openai.types.responses import ResponseTextDeltaEvent from agents import Agent, Runner async def main(): agent = Agent( name="Joker", instructions="You are a helpful assistant.", ) result = Runner.run_streamed(agent, input="Please tell me 5 jokes.") async for even...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/agent_patterns/input_guardrails.py
null
null
null
null
null
null
Python
2026-05-04T02:26:35.573559
from __future__ import annotations import asyncio from pydantic import BaseModel from agents import ( Agent, GuardrailFunctionOutput, InputGuardrailTripwireTriggered, RunContextWrapper, Runner, TResponseInputItem, input_guardrail, ) from examples.auto_mode import input_with_fallback, is_a...
openai/openai-agents-python
https://github.com/openai/openai-agents-python
null
null
null
null
25,823
null
null
mit
null
null
null
null
null
null
null
examples/basic/remote_image.py
null
null
null
null
null
null
Python
2026-05-04T02:26:38.152379
import asyncio from agents import Agent, Runner URL = "https://images.unsplash.com/photo-1505761671935-60b3a7427bad?auto=format&fit=crop&w=400&q=80" async def main(): agent = Agent( name="Assistant", instructions="You are a helpful assistant.", ) result = await Runner.run( agent...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/garage.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.698877
""" Garage Parking Rearrangement There is a parking lot with only one empty spot (represented by 0). Given the initial and final states, find the minimum number of moves to rearrange the lot. Each move swaps a car into the empty spot. Reference: https://en.wikipedia.org/wiki/15_puzzle Complexity: Time: O(n^2) w...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/flatten.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.699862
""" Flatten Arrays Given an array that may contain nested arrays, produce a single flat resultant array. Reference: https://en.wikipedia.org/wiki/Flatten_(higher-order_function) Complexity: Time: O(n) where n is the total number of elements Space: O(n) """ from __future__ import annotations from collectio...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/longest_non_repeat.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.706580
""" Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. Multiple algorithm variants are provided. Reference: https://leetcode.com/problems/longest-substring-without-repeating-characters/ Complexity: Time: O(n) for all variants ...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/max_ones_index.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.707787
""" Max Ones Index Find the index of the 0 that, when replaced with 1, produces the longest continuous sequence of 1s in a binary array. Returns -1 if no 0 exists. Reference: https://www.geeksforgeeks.org/find-index-0-replaced-1-get-longest-continuous-sequence-1s-binary-array/ Complexity: Time: O(n) Space: ...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.716435
from .delete_nth import delete_nth, delete_nth_naive from .flatten import flatten, flatten_iter from .garage import garage from .josephus import josephus from .limit import limit from .longest_non_repeat import ( get_longest_non_repeat_v1, get_longest_non_repeat_v2, get_longest_non_repeat_v3, longest_no...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/merge_intervals.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.717482
""" Merge Intervals Given a collection of intervals, merge all overlapping intervals into a consolidated set. Reference: https://en.wikipedia.org/wiki/Interval_(mathematics) Complexity: Time: O(n log n) due to sorting Space: O(n) """ from __future__ import annotations class Interval: """A numeric int...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.732209
"""Pythonic data structures and algorithms for education. Shared types are available at the top level:: >>> from algorithms import TreeNode, ListNode, Graph >>> from algorithms.data_structures import BinaryHeap, HashTable >>> from algorithms.graph import dijkstra """ import algorithms.data_structures as ...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/josephus.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.732742
""" Josephus Problem People sit in a circular fashion; every k-th person is eliminated until everyone has been removed. Yield the elimination order. Reference: https://en.wikipedia.org/wiki/Josephus_problem Complexity: Time: O(n^2) due to list.pop at arbitrary index Space: O(1) auxiliary (yields in-place) "...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/delete_nth.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.733237
""" Delete Nth Occurrence Given a list and a number N, create a new list that contains each element of the original list at most N times, without reordering. Reference: https://www.geeksforgeeks.org/remove-duplicates-from-an-array/ Complexity: delete_nth_naive: Time: O(n^2) due to list.count() S...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/limit.py
null
null
null
null
null
null
Python
2026-05-04T02:26:40.734864
""" Limit Array Values Filter an array to include only elements within a specified minimum and maximum range (inclusive). Reference: https://en.wikipedia.org/wiki/Clipping_(signal_processing) Complexity: Time: O(n) Space: O(n) """ from __future__ import annotations def limit( array: list[int], mi...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/move_zeros.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.748754
""" Move Zeros Move all zeros in an array to the end while preserving the relative order of the non-zero (and non-integer-zero) elements. Reference: https://leetcode.com/problems/move-zeroes/ Complexity: Time: O(n) Space: O(n) """ from __future__ import annotations from typing import Any def move_zeros(...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/missing_ranges.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.750329
""" Missing Ranges Find the ranges of numbers that are missing between a given low and high bound, given a sorted array of integers. Reference: https://leetcode.com/problems/missing-ranges/ Complexity: Time: O(n) Space: O(n) for the result list """ from __future__ import annotations def missing_ranges(ar...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/plus_one.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.751546
""" Plus One Given a non-negative number represented as an array of digits (big-endian), add one to the number and return the resulting digit array. Reference: https://leetcode.com/problems/plus-one/ Complexity: Time: O(n) Space: O(n) for v1, O(1) auxiliary for v2 and v3 """ from __future__ import annotati...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/trimmean.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.752746
""" Trimmed Mean Compute the mean of an array after discarding a given percentage of the highest and lowest values. Useful for robust averaging in scoring systems. Reference: https://en.wikipedia.org/wiki/Truncated_mean Complexity: Time: O(n log n) due to sorting Space: O(n) for the trimmed copy """ from _...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/top_1.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.754228
""" Top 1 (Mode) Find the most frequently occurring value(s) in an array. When multiple values share the highest frequency, all are returned. Reference: https://en.wikipedia.org/wiki/Mode_(statistics) Complexity: Time: O(n) Space: O(n) """ from __future__ import annotations from typing import Any def to...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/n_sum.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.755205
""" N-Sum Given an array of integers, find all unique n-tuples that sum to a target value. Supports custom sum, comparison, and equality closures for advanced use cases with non-integer elements. Reference: https://leetcode.com/problems/4sum/ Complexity: Time: O(n^(k-1)) where k is the tuple size Space: O(n...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/remove_duplicates.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.767100
""" Remove Duplicates Remove duplicate elements from an array while preserving the original order. Handles both hashable and unhashable items. Reference: https://en.wikipedia.org/wiki/Duplicate_code Complexity: Time: O(n) for hashable items / O(n^2) worst case for unhashable items Space: O(n) """ from __fu...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/summarize_ranges.py
null
null
null
null
null
null
Python
2026-05-04T02:26:41.768951
""" Summarize Ranges Given a sorted integer array without duplicates, return the summary of its ranges as a list of (start, end) tuples. Reference: https://leetcode.com/problems/summary-ranges/ Complexity: Time: O(n) Space: O(n) for the result list """ from __future__ import annotations def summarize_ran...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/rotate.py
null
null
null
null
null
null
Python
2026-05-04T02:26:42.700507
""" Rotate Array Rotate an array of n elements to the right by k steps. Three algorithm variants are provided with different time complexities. Reference: https://leetcode.com/problems/rotate-array/ Complexity: rotate_v1: Time O(n*k), Space O(n) rotate_v2: Time O(n), Space O(n) rotate_v3: Time O(n), ...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/combination_sum.py
null
null
null
null
null
null
Python
2026-05-04T02:26:42.935609
""" Combination Sum Given a set of candidate numbers (without duplicates) and a target number, find all unique combinations where the candidate numbers sum to the target. The same number may be chosen an unlimited number of times. Reference: https://leetcode.com/problems/combination-sum/ Complexity: Time: O(n^(...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/find_words.py
null
null
null
null
null
null
Python
2026-05-04T02:26:42.936948
""" Word Search II Given a board of characters and a list of words, find all words that can be constructed from adjacent cells (horizontally or vertically). Each cell may only be used once per word. Uses a trie for efficient prefix matching. Reference: https://leetcode.com/problems/word-search-ii/ Complexity: Ti...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/array/two_sum.py
null
null
null
null
null
null
Python
2026-05-04T02:26:42.953519
""" Two Sum Given an array of integers and a target sum, return the indices of the two numbers that add up to the target. Reference: https://leetcode.com/problems/two-sum/ Complexity: Time: O(n) Space: O(n) """ from __future__ import annotations def two_sum(array: list[int], target: int) -> tuple[int, in...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:42.955892
from .add_operators import add_operators from .anagram import anagram from .array_sum_combinations import ( array_sum_combinations, unique_array_sum_combinations, ) from .combination_sum import combination_sum from .factor_combinations import get_factors, recursive_get_factors from .find_words import find_words...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/anagram.py
null
null
null
null
null
null
Python
2026-05-04T02:26:42.957292
""" Anagram Checker Given two strings, determine if they are anagrams of each other (i.e. one can be rearranged to form the other). Reference: https://en.wikipedia.org/wiki/Anagram Complexity: Time: O(n) where n is the length of the strings Space: O(1) fixed 26-character alphabet """ from __future__ import...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/array_sum_combinations.py
null
null
null
null
null
null
Python
2026-05-04T02:26:43.594253
""" Array Sum Combinations Given three arrays and a target sum, find all three-element combinations (one element from each array) that add up to the target. Reference: https://en.wikipedia.org/wiki/Subset_sum_problem Complexity: Time: O(n^3) brute-force product of three arrays Space: O(k) where k is the num...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/factor_combinations.py
null
null
null
null
null
null
Python
2026-05-04T02:26:43.595318
""" Factor Combinations Given an integer n, return all possible combinations of its factors. Factors should be greater than 1 and less than n. Reference: https://leetcode.com/problems/factor-combinations/ Complexity: Time: O(n * log(n)) approximate Space: O(log(n)) recursion depth """ from __future__ impor...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/generate_abbreviations.py
null
null
null
null
null
null
Python
2026-05-04T02:26:44.893436
""" Generalized Abbreviations Given a word, return all possible generalized abbreviations. Each abbreviation replaces contiguous substrings with their lengths. Reference: https://leetcode.com/problems/generalized-abbreviation/ Complexity: Time: O(2^n) where n is the length of the word Space: O(n) recursion ...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/subsets.py
null
null
null
null
null
null
Python
2026-05-04T02:26:45.628719
""" Subsets Given a set of distinct integers, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Reference: https://en.wikipedia.org/wiki/Power_set Complexity: Time: O(2^n) where n is the number of elements Space: O(2^n) to store all subsets """ from __future_...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/subsets_unique.py
null
null
null
null
null
null
Python
2026-05-04T02:26:46.579673
""" Unique Subsets Given a collection of integers that might contain duplicates, return all possible unique subsets (the power set without duplicates). Reference: https://leetcode.com/problems/subsets-ii/ Complexity: Time: O(2^n) where n is the number of elements Space: O(2^n) to store all subsets """ from...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/bit_manipulation/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:26:47.315342
from .add_bitwise_operator import add_bitwise_operator from .binary_gap import binary_gap from .bit_operation import clear_bit, get_bit, set_bit, update_bit from .bytes_int_conversion import ( bytes_big_endian_to_int, bytes_little_endian_to_int, int_to_bytes_big_endian, int_to_bytes_little_endian, ) fro...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/backtracking/add_operators.py
null
null
null
null
null
null
Python
2026-05-04T02:26:47.540367
""" Expression Add Operators Given a string of digits and a target value, return all possibilities to insert binary operators (+, -, *) between the digits so they evaluate to the target value. Reference: https://leetcode.com/problems/expression-add-operators/ Complexity: Time: O(4^n) worst Space: O(n) recur...
keon/algorithms
https://github.com/keon/algorithms
null
null
null
null
25,439
null
null
mit
null
null
null
null
null
null
null
algorithms/bit_manipulation/add_bitwise_operator.py
null
null
null
null
null
null
Python
2026-05-04T02:26:47.926100
""" Add Bitwise Operator Add two positive integers without using the '+' operator, using only bitwise operations (AND, XOR, shift). Reference: https://en.wikipedia.org/wiki/Adder_(electronics) Complexity: Time: O(log n) where n is the larger of the two inputs Space: O(1) """ from __future__ import annotati...