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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/reinitialize_route_http_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:26.478933 | """HTTP integration tests for the /v1/reinitialize route."""
from pathlib import Path
import unittest
from types import SimpleNamespace
from unittest import mock
from fastapi import FastAPI, Header, HTTPException
from fastapi.testclient import TestClient
from acestep.api.http.reinitialize_route import register_reini... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/model_init_service_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:26.586433 | """Unit tests for blocking model initialization service helpers."""
import threading
import unittest
from types import SimpleNamespace
from unittest import mock
from acestep.api.http.model_init_service import initialize_models_for_request
class _FakeHandler:
"""Fake DiT handler providing initialize_service cont... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_audio_paths_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:26.647822 | """Unit tests for audio path validation and temp upload persistence helpers."""
import asyncio
import os
import tempfile
import unittest
from unittest import mock
from fastapi import HTTPException
from acestep.api.http.release_task_audio_paths import save_upload_to_temp, validate_audio_path
class _FakeUpload:
... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_audio_paths.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:26.648382 | """Audio-path validation and upload persistence helpers for release-task flow."""
from __future__ import annotations
import os
import tempfile
from pathlib import Path
from typing import Optional
from fastapi import HTTPException
from starlette.datastructures import UploadFile as StarletteUploadFile
def validate_a... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:26.692225 | """Pydantic request model definitions used by the `/release_task` flow."""
from __future__ import annotations
from typing import List, Literal, Optional, Union
from pydantic import BaseModel, Field
from acestep.constants import DEFAULT_DIT_INSTRUCTION
class GenerateMusicRequest(BaseModel):
"""Typed request pa... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_request_builder_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.244338 | """Unit tests for release-task request-model builder helpers."""
import unittest
from types import SimpleNamespace
from acestep.api.http.release_task_request_builder import build_generate_music_request
class _FakeParser:
"""Minimal parser stub exposing typed accessors used by request builder."""
def __init... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_request_builder.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.244856 | """Helpers for building release-task request models from parsed inputs."""
from __future__ import annotations
from typing import Any, Optional
def build_generate_music_request(
parser: Any,
request_model_cls: Any,
default_dit_instruction: str,
lm_default_temperature: float,
lm_default_cfg_scale:... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_param_parser.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.246767 | """Canonical parameter aliasing and parsing helpers for release-task requests."""
from __future__ import annotations
import json
from typing import Any, Dict, Optional
PARAM_ALIASES: Dict[str, list[str]] = {
"prompt": ["prompt", "caption"],
"lyrics": ["lyrics"],
"thinking": ["thinking"],
"analysis_o... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_param_parser_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.248051 | """Unit tests for canonical request parameter parsing helpers."""
import unittest
from acestep.api.http.release_task_param_parser import RequestParser
class ReleaseTaskParamParserTests(unittest.TestCase):
"""Behavior tests for alias resolution and typed conversion in RequestParser."""
def test_get_prefers_... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/reinitialize_route_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.389715 | """Unit tests for reinitialize route registration."""
import asyncio
import unittest
from types import SimpleNamespace
from unittest import mock
from fastapi import FastAPI, HTTPException
from fastapi.routing import APIRoute
from acestep.api.http.reinitialize_route import register_reinitialize_route
def _wrap_resp... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_route.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.461179 | """HTTP route registration for ``/release_task`` task-submission endpoint."""
from __future__ import annotations
import asyncio
import os
from typing import Any, Callable, Dict, Optional
from fastapi import FastAPI, Header, HTTPException, Request
from acestep.api.http.release_task_request_parser import parse_releas... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_request_parser.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.490166 | """Request parsing helpers for the ``/release_task`` HTTP route."""
from __future__ import annotations
import json
import os
import urllib.parse
from typing import Any, Callable, Dict, Optional, Tuple
from fastapi import HTTPException, Request
from acestep.api.http.release_task_request_builder import build_generate... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_request_parser_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:27.625322 | """Unit tests for release-task request parsing helper."""
import asyncio
import json
import unittest
from types import SimpleNamespace
from unittest import mock
from fastapi import HTTPException
from acestep.api.http.release_task_request_parser import parse_release_task_request
class _FakeParser:
"""Minimal pa... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_models_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.208905 | """Unit tests for release-task request model defaults and compatibility flags."""
import unittest
from acestep.api.http.release_task_models import GenerateMusicRequest
from acestep.constants import DEFAULT_DIT_INSTRUCTION
class ReleaseTaskModelsTests(unittest.TestCase):
"""Behavior tests for release-task reques... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/sample_format_routes_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.292884 | """Unit tests for sample/format route registration."""
import asyncio
import json
import threading
import unittest
from types import SimpleNamespace
from fastapi import FastAPI, HTTPException
from fastapi.routing import APIRoute
from acestep.api.http.sample_format_routes import register_sample_format_routes
def _w... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/sample_format_routes.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.293607 | """HTTP routes for random sample creation and input formatting."""
from __future__ import annotations
import json
import os
from threading import Lock
from typing import Any, Callable, Dict, List, Optional
from fastapi import FastAPI, Header, HTTPException, Request
def register_sample_format_routes(
app: FastA... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/sample_format_routes_http_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.297018 | """HTTP integration tests for sample/format routes."""
import threading
import unittest
from types import SimpleNamespace
from fastapi import FastAPI, HTTPException
from fastapi.testclient import TestClient
from acestep.api.http.sample_format_routes import register_sample_format_routes
def _wrap_response(data, cod... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_analysis_runtime.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.326016 | """Analysis-mode runtime helpers for API job generation."""
from __future__ import annotations
import os
from typing import Any, Optional
def maybe_handle_analysis_only_modes(
*,
req: Any,
params: Any,
config: Any,
llm_handler: Any,
dit_handler: Any,
store: Any,
job_id: str,
) -> Opt... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_blocking_generation_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.423899 | """Unit tests for blocking generation orchestration helper."""
from __future__ import annotations
import unittest
from types import SimpleNamespace
from unittest.mock import MagicMock, patch
from acestep.api.job_blocking_generation import run_blocking_generate
class JobBlockingGenerationTests(unittest.TestCase):
... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/http/release_task_route_http_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.438483 | """HTTP integration tests for release-task route registration."""
import asyncio
import time
import unittest
from types import SimpleNamespace
from fastapi import FastAPI, HTTPException
from fastapi.testclient import TestClient
from acestep.api.http.release_task_route import register_release_task_route
class _Fake... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_analysis_runtime_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.472739 | """Unit tests for analysis-only runtime helpers."""
from __future__ import annotations
import os
import unittest
from types import SimpleNamespace
from unittest.mock import MagicMock, patch
from acestep.api.job_analysis_runtime import maybe_handle_analysis_only_modes
class JobAnalysisRuntimeTests(unittest.TestCase... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_execution_runtime.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.473376 | """Async job execution runtime helper for API queue workers."""
from __future__ import annotations
import asyncio
import time
import traceback
from typing import Any, Awaitable, Callable
async def run_one_job_runtime(
*,
app_state: Any,
store: Any,
job_id: str,
req: Any,
ensure_models_initia... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_blocking_generation.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.689549 | """Blocking generation orchestration helper for API jobs."""
from __future__ import annotations
import os
import time
from typing import Any, Callable
from acestep.api.job_analysis_runtime import maybe_handle_analysis_only_modes
from acestep.api.job_generation_runtime import run_generation_with_optional_sequential_c... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_execution_runtime_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.815826 | """Unit tests for async job execution runtime helper."""
from __future__ import annotations
import asyncio
import unittest
from collections import deque
from concurrent.futures import ThreadPoolExecutor
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock, patch
from acestep.api.job_execu... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_generation_runtime_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.874434 | """Unit tests for generation runtime execution helper."""
from __future__ import annotations
import unittest
from types import SimpleNamespace
from unittest.mock import MagicMock
from acestep.api.job_generation_runtime import run_generation_with_optional_sequential_cover_mode
class JobGenerationRuntimeTests(unitte... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_generation_runtime.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.882264 | """Runtime helpers for executing generation runs and aggregating outputs."""
from __future__ import annotations
from typing import Any, Callable
def run_generation_with_optional_sequential_cover_mode(
*,
req: Any,
job_id: str,
handler_device: str,
config: Any,
params: Any,
dit_handler: A... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_generation_setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.883162 | """Generation parameter/config assembly helpers for API job execution."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Callable, Optional
from acestep.inference import GenerationConfig, GenerationParams
# Sentinel value indicating the LM should auto-calculate duration... |
ace-step/ACE-Step-1.5 | https://github.com/ace-step/ACE-Step-1.5 | null | null | null | null | 9,949 | null | null | mit | null | null | null | null | null | null | null | acestep/api/job_generation_setup_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:28.929706 | """Unit tests for generation setup assembly helpers."""
from __future__ import annotations
import unittest
from types import SimpleNamespace
from acestep.api.job_generation_setup import build_generation_setup
def _base_req() -> SimpleNamespace:
return SimpleNamespace(
task_type="text2music",
in... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.307607 | """
Donut
Copyright (c) 2022-present NAVER Corp.
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
"""
from .model import NougatConfig, NougatModel
from .utils.dataset import NougatDataset
from ._version import __version__
__all__ = [
"NougatConfig",
"NougatModel",
"NougatDataset",
]
|
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/parser/html2md.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.314069 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import argparse
from pathlib import Path
from typing import List, Optional
from bs4 import BeautifulSoup
from tqdm import tqdm
import htmlmi... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | app.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.328111 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
import sys
from functools import partial
from http import HTTPStatus
from fastapi import FastAPI, File, UploadFile
from PIL import... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/create_index.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.328670 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
"""
This script creates an index of all available pages and parses the meta data for all pages into a separate file.
Optionally TesseractOCR... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/gen_seek.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.342714 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from tqdm import tqdm
import json
from pathlib import Path
import argparse
def get_args():
parser = argparse.ArgumentParser()
pars... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/_version.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.348350 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
__version__ = "0.1.18"
|
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | lightning_module.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.349598 | """
Donut
Copyright (c) 2022-present NAVER Corp.
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
"""
import math
import random
from pathlib import Path
import numpy as np
import lightning.pytorch as pl
import torch
from lightning.pytorch.utilities import rank_zero_only
from torch.nn.utils.rnn import pad... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/parser/document.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.351088 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from collections import defaultdict
from copy import copy
import itertools
import re
from dataclasses import dataclass, field, asdict
from t... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/rasterize.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.952122 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import argparse
import logging
import pypdfium2
from pathlib import Path
from tqdm import tqdm
import io
from typing import Optional, List, ... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/pdffigures.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.953242 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
import subprocess
import logging
PDFFIGURES2_JAR_PATH = os.environ.get("PDFFIGURES_PATH", None)
logger = logging.getLogger()
if P... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/splitter.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.971002 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import List, Tuple, Union
import re
import numpy as np
from rapidfuzz.fuzz import ratio as ratio_perc
from fuzzysearch import f... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/parser/latexml_parser.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.984885 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import re
import sys
import requests
from typing import Optional, Set
from bs4 import BeautifulSoup, NavigableString
import soupsieve as sv
... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/staircase.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.993190 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from collections import deque
import operator
import itertools
from typing import Optional, List, Tuple
import numpy as np
import warnings
... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/split_htmls_to_pages.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.994642 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import argparse
from io import BytesIO
import multiprocessing
from pebble import ProcessPool
from concurrent.futures import TimeoutError
fro... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/parser/markdown.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.995871 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Iterable, List, Optional, Tuple
import re
from uuid import uuid4
from nougat.dataset.utils import normalize_tex
from noug... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/utils/latex_conversion.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:31.997702 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import re
from pylatexenc.latexencode import UnicodeToLatexEncoder
from pylatexenc.latex2text import LatexNodes2Text
from unidecode import u... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/utils/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:32.028177 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from nougat.dataset.utils.latex_conversion import *
from nougat.dataset.utils.utils import *
|
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/split_md_to_pages.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:32.029499 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import argparse
from collections import Counter
from copy import deepcopy
import json
import math
from operator import itemgetter
import re... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/utils/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.306683 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import re
def remove_pretty_linebreaks(string: str) -> str:
"""replaces linebreaks with spaces when there would be no
difference b... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/dataset/utils/pdf_text_extract.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.311761 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from io import StringIO
from typing import List
import re
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/utils/checkpoint.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.313015 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import requests
import os
import tqdm
import io
from pathlib import Path
import torch
BASE_URL = "https://githu... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/utils/device.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.314610 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
import logging
def default_batch_size():
if torch.cuda.is_available():
batch_size = int(
torch.cuda.g... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/model.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.315227 | """
Donut
Copyright (c) 2022-present NAVER Corp.
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
"""
import logging
import math
import os
from typing import List, Optional, Union
from collections import defaultdict
from pathlib import Path
import numpy as np
from PIL import Image
import cv2
import timm
... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/transforms.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.315681 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
# Implements image augmentation
import albumentations as alb
from albumentations.pytorch import ToTensorV2
import cv2
import numpy as np
fr... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/utils/dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.316132 | """
Donut
Copyright (c) 2022-present NAVER Corp.
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
"""
import logging
import os
from math import prod
from pathlib import Path
from functools import partial
import random
from typing import Dict, Tuple, Callable
from PIL import Image, UnidentifiedImageError
f... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.317058 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import argparse
from multiprocessing import Pool
import re
from pathlib import Path
from collections import defaultdict
from typing import L... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | nougat/postprocessing.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:33.317615 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Union, List
import re
import os
import numpy as np
from nltk.corpus import words
from multiprocessing import Pool
from f... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | predict.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:34.322858 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import sys
from pathlib import Path
import logging
import re
import argparse
import re
import os
from functools import partial
import torch
... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | test.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:34.491106 | """
Donut
Copyright (c) 2022-present NAVER Corp.
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
"""
import argparse
import json
import os
import logging
from multiprocessing import Pool
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
from tqdm import tqdm
f... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | train.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:34.525019 | """
Donut
Copyright (c) 2022-present NAVER Corp.
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
"""
import argparse
import datetime
import os
from os.path import basename
from pathlib import Path
import lightning.pytorch as pl
import torch
from lightning.pytorch.callbacks import (
LearningRateMonit... |
facebookresearch/nougat | https://github.com/facebookresearch/nougat | null | null | null | null | 9,943 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:35.507688 | """
Donut
Copyright (c) 2022-present NAVER Corp.
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
"""
import os
from setuptools import find_packages, setup
ROOT = os.path.abspath(os.path.dirname(__file__))
def read_version():
data = {}
path = os.path.join(ROOT, "nougat", "_version.py")
wit... |
microsoft/fluentui-emoji | https://github.com/microsoft/fluentui-emoji | null | null | null | null | 9,937 | null | null | mit | null | null | null | null | null | null | null | scripts/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:41.558198 | # utils.py
import csv
from pathlib import Path
"""
Utilities for scripts
"""
groups = [
'Objects',
'People & Body',
'Smileys & Emotion',
'Animals & Nature',
'Food & Drink',
'Symbols',
'Travel & Places',
'Activities',
'Flags',
]
styles = ["3D", "Color", "Flat", "High Contrast"... |
microsoft/fluentui-emoji | https://github.com/microsoft/fluentui-emoji | null | null | null | null | 9,937 | null | null | mit | null | null | null | null | null | null | null | scripts/check_assets.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:41.608206 | # check_assets.py
"""
Performs several checks on asset folder contents including:
- metadata content
- folder content
"""
import argparse
import json
from pathlib import Path
import sys
from utils import styles
SK_FOLDERS = {'Default',
'Light',
'Medium-Light',
'Medium',
... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/async-tools.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.083384 | import asyncio
import ollama
from ollama import ChatResponse
def add_two_numbers(a: int, b: int) -> int:
"""
Add two numbers
Args:
a (int): The first number
b (int): The second number
Returns:
int: The sum of the two numbers
"""
return a + b
def subtract_two_numbers(a: int, b: int) -> int... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/async-chat.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.105144 | import asyncio
from ollama import AsyncClient
async def main():
messages = [
{
'role': 'user',
'content': 'Why is the sky blue?',
},
]
client = AsyncClient()
response = await client.chat('gemma3', messages=messages)
print(response['message']['content'])
if __name__ == '__main__':
a... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/async-structured-outputs.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.123544 | import asyncio
from pydantic import BaseModel
from ollama import AsyncClient
# Define the schema for the response
class FriendInfo(BaseModel):
name: str
age: int
is_available: bool
class FriendList(BaseModel):
friends: list[FriendInfo]
async def main():
client = AsyncClient()
response = await client... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/create.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.125331 | from ollama import Client
client = Client()
response = client.create(
model='my-assistant',
from_='gemma3',
system='You are mario from Super Mario Bros.',
stream=False,
)
print(response.status)
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/chat-stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.126521 | from ollama import chat
messages = [
{
'role': 'user',
'content': 'Why is the sky blue?',
},
]
for part in chat('gemma3', messages=messages, stream=True):
print(part['message']['content'], end='', flush=True)
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/async-generate.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.146608 | import asyncio
import ollama
async def main():
client = ollama.AsyncClient()
response = await client.generate('gemma3', 'Why is the sky blue?')
print(response['response'])
if __name__ == '__main__':
try:
asyncio.run(main())
except KeyboardInterrupt:
print('\nGoodbye!')
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/chat.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.148114 | from ollama import chat
messages = [
{
'role': 'user',
'content': 'Why is the sky blue?',
},
]
response = chat('gemma3', messages=messages)
print(response['message']['content'])
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/chat-with-history.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.149290 | from ollama import chat
messages = [
{
'role': 'user',
'content': 'Why is the sky blue?',
},
{
'role': 'assistant',
'content': "The sky is blue because of the way the Earth's atmosphere scatters sunlight.",
},
{
'role': 'user',
'content': 'What is the weather in Tokyo?',
},
{
... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/embed.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.175515 | from ollama import embed
response = embed(model='llama3.2', input='Hello, world!')
print(response['embeddings'])
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/chat-logprobs.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:44.176971 | from typing import Iterable
import ollama
def print_logprobs(logprobs: Iterable[dict], label: str) -> None:
print(f'\n{label}:')
for entry in logprobs:
token = entry.get('token', '')
logprob = entry.get('logprob')
print(f' token={token!r:<12} logprob={logprob:.3f}')
for alt in entry.get('top_log... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/generate-image.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.038180 | # Image generation is experimental and currently only available on macOS
import base64
from ollama import generate
prompt = 'a sunset over mountains'
print(f'Prompt: {prompt}')
for response in generate(model='x/z-image-turbo', prompt=prompt, stream=True):
if response.image:
# Final response contains the image... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/fill-in-middle.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.039108 | from ollama import generate
prompt = '''def remove_non_ascii(s: str) -> str:
""" '''
suffix = """
return result
"""
response = generate(
model='codellama:7b-code',
prompt=prompt,
suffix=suffix,
options={
'num_predict': 128,
'temperature': 0,
'top_p': 0.9,
'stop': ['<EOT>'],
},
)
pr... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/generate-stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.040737 | from ollama import generate
for part in generate('gemma3', 'Why is the sky blue?', stream=True):
print(part['response'], end='', flush=True)
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/generate-logprobs.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.041607 | from typing import Iterable
import ollama
def print_logprobs(logprobs: Iterable[dict], label: str) -> None:
print(f'\n{label}:')
for entry in logprobs:
token = entry.get('token', '')
logprob = entry.get('logprob')
print(f' token={token!r:<12} logprob={logprob:.3f}')
for alt in entry.get('top_log... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/multimodal-chat.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.150468 | from ollama import chat
# from pathlib import Path
# Pass in the path to the image
path = input('Please enter the path to the image: ')
# You can also pass in base64 encoded image data
# img = base64.b64encode(Path(path).read_bytes()).decode()
# or the raw bytes
# img = Path(path).read_bytes()
response = chat(
mo... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/multimodal-generate.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.601247 | import random
import sys
import httpx
from ollama import generate
latest = httpx.get('https://xkcd.com/info.0.json')
latest.raise_for_status()
num = int(sys.argv[1]) if len(sys.argv) > 1 else random.randint(1, latest.json().get('num'))
comic = httpx.get(f'https://xkcd.com/{num}/info.0.json')
comic.raise_for_status... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/show.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.640739 | from ollama import ShowResponse, show
response: ShowResponse = show('gemma3')
print('Model Information:')
print(f'Modified at: {response.modified_at}')
print(f'Template: {response.template}')
print(f'Modelfile: {response.modelfile}')
print(f'License: {response.license}')
print(f'Details: {respon... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/ps.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.691358 | from ollama import ProcessResponse, chat, ps, pull
# Ensure at least one model is loaded
response = pull('gemma3', stream=True)
progress_states = set()
for progress in response:
if progress.get('status') in progress_states:
continue
progress_states.add(progress.get('status'))
print(progress.get('status'))
p... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/pull.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.703113 | from tqdm import tqdm
from ollama import pull
current_digest, bars = '', {}
for progress in pull('gemma3', stream=True):
digest = progress.get('digest', '')
if digest != current_digest and current_digest in bars:
bars[current_digest].close()
if not digest:
print(progress.get('status'))
continue
... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/structured-outputs-image.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.773038 | from pathlib import Path
from typing import Literal
from pydantic import BaseModel
from ollama import chat
# Define the schema for image objects
class Object(BaseModel):
name: str
confidence: float
attributes: str
class ImageDescription(BaseModel):
summary: str
objects: list[Object]
scene: str
color... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/gpt-oss-tools.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.803982 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "gpt-oss",
# "ollama",
# "rich",
# ]
# ///
import random
from rich import print
from ollama import Client
from ollama._types import ChatResponse
def get_weather(city: str) -> str:
"""
Get the current temperature for a city
Args:
... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/list.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.835540 | from ollama import ListResponse, list
response: ListResponse = list()
for model in response.models:
print('Name:', model.model)
print(' Size (MB):', f'{(model.size.real / 1024 / 1024):.2f}')
if model.details:
print(' Format:', model.details.format)
print(' Family:', model.details.family)
print(' ... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/gpt-oss-tools-stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.906656 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "gpt-oss",
# "ollama",
# "rich",
# ]
# ///
import random
from typing import Iterator
from rich import print
from ollama import Client
from ollama._types import ChatResponse
def get_weather(city: str) -> str:
"""
Get the current temperatu... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/multi-tool.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.907861 | import random
from typing import Iterator
from ollama import ChatResponse, Client
def get_temperature(city: str) -> int:
"""
Get the temperature for a city in Celsius
Args:
city (str): The name of the city
Returns:
int: The current temperature in Celsius
"""
# This is a mock implementation - wo... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/generate.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:45.924805 | from ollama import generate
response = generate('gemma3', 'Why is the sky blue?')
print(response['response'])
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/structured-outputs.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.215034 | from pydantic import BaseModel
from ollama import chat
# Define the schema for the response
class FriendInfo(BaseModel):
name: str
age: int
is_available: bool
class FriendList(BaseModel):
friends: list[FriendInfo]
# schema = {'type': 'object', 'properties': {'friends': {'type': 'array', 'items': {'type':... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/thinking-generate.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.277527 | from ollama import generate
response = generate('deepseek-r1', 'why is the sky blue', think=True)
print('Thinking:\n========\n\n' + response.thinking)
print('\nResponse:\n========\n\n' + response.response)
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/thinking.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.294368 | from ollama import chat
messages = [
{
'role': 'user',
'content': 'What is 10 + 23?',
},
]
response = chat('deepseek-r1', messages=messages, think=True)
print('Thinking:\n========\n\n' + response.message.thinking)
print('\nResponse:\n========\n\n' + response.message.content)
|
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/thinking-levels.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.318247 | from ollama import chat
def heading(text):
print(text)
print('=' * len(text))
messages = [
{'role': 'user', 'content': 'What is 10 + 23?'},
]
# gpt-oss supports 'low', 'medium', 'high'
levels = ['low', 'medium', 'high']
for i, level in enumerate(levels):
response = chat('gpt-oss:20b', messages=messages, th... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/tools.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.346494 | from ollama import ChatResponse, chat
def add_two_numbers(a: int, b: int) -> int:
"""
Add two numbers
Args:
a (int): The first number
b (int): The second number
Returns:
int: The sum of the two numbers
"""
# The cast is necessary as returned tool call arguments don't always conform exactly ... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/web-search-gpt-oss.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.422119 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "ollama",
# ]
# ///
from typing import Any, Dict, List
from web_search_gpt_oss_helper import Browser
from ollama import Client
def main() -> None:
client = Client()
browser = Browser(initial_state=None, client=client)
def browser_search(query... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/web-search-mcp.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.422659 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "mcp",
# "rich",
# "ollama",
# ]
# ///
"""
MCP stdio server exposing Ollama web_search and web_fetch as tools.
Environment:
- OLLAMA_API_KEY (required): if set, will be used as Authorization header.
"""
from __future__ import annotations
import asy... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/web-search.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.458528 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "rich",
# "ollama",
# ]
# ///
from typing import Union
from rich import print
from ollama import WebFetchResponse, WebSearchResponse, chat, web_fetch, web_search
def format_tool_results(
results: Union[WebSearchResponse, WebFetchResponse],
u... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | examples/web_search_gpt_oss_helper.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.488426 | from __future__ import annotations
import re
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any, Dict, List, Optional, Protocol, Tuple
from urllib.parse import urlparse
from ollama import Client
@dataclass
class Page:
url: str
title: str
text: str
lines: List[str]
... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | ollama/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.488881 | from ollama._client import AsyncClient, Client
from ollama._types import (
ChatResponse,
EmbeddingsResponse,
EmbedResponse,
GenerateResponse,
Image,
ListResponse,
Message,
Options,
ProcessResponse,
ProgressResponse,
RequestError,
ResponseError,
ShowResponse,
StatusResponse,
Tool,
WebFetc... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | ollama/_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.852770 | import contextlib
import ipaddress
import json
import os
import platform
import sys
import urllib.parse
from hashlib import sha256
from os import PathLike
from pathlib import Path
from typing import (
Any,
Callable,
Dict,
List,
Literal,
Mapping,
Optional,
Sequence,
Type,
TypeVar,
Union,
overload... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | ollama/_types.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.924982 | import contextlib
import json
from base64 import b64decode, b64encode
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Mapping, Optional, Sequence, Union
from pydantic import (
BaseModel,
ByteSize,
ConfigDict,
Field,
model_serializer,
)
from pydantic.json_schema impo... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | ollama/_utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.945384 | from __future__ import annotations
import inspect
import re
from collections import defaultdict
from typing import Callable, Union
import pydantic
from ollama._types import Tool
def _parse_docstring(doc_string: Union[str, None]) -> dict[str, str]:
parsed_docstring = defaultdict(str)
if not doc_string:
retu... |
ollama/ollama-python | https://github.com/ollama/ollama-python | null | null | null | null | 9,917 | null | null | mit | null | null | null | null | null | null | null | tests/test_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:02:46.969641 | import base64
import json
import os
import re
import tempfile
from pathlib import Path
from typing import Any
import pytest
from httpx import Response as httpxResponse
from pydantic import BaseModel
from pytest_httpserver import HTTPServer, URIPattern
from werkzeug.wrappers import Request, Response
from ollama._clien... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.