repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
onyx | backend/onyx/voice/providers/elevenlabs.py | .py | """ElevenLabs voice provider for STT and TTS.
ElevenLabs supports:
- **STT**: Scribe API (batch via REST, streaming via WebSocket with Scribe v2 Realtime).
The streaming endpoint sends base64-encoded PCM16 audio chunks and receives JSON
transcript messages (partial_transcript, committed_transcript, utterance_end).... | 939 | 37,599 |
onyx | backend/onyx/voice/providers/azure.py | .py | """Azure Speech Services voice provider for STT and TTS.
Azure supports:
- **STT**: Batch transcription via REST API (audio/wav POST) and real-time
streaming via the Azure Speech SDK (push audio stream with continuous
recognition). The SDK handles VAD natively through its recognizing/recognized
events.
- **TTS**... | 776 | 31,574 |
onyx | backend/onyx/connectors/source_operations.py | .py | """Source operations: the per-connector gateway for all remote source calls.
Validation that is written as parallel probe code duplicates the connector's API
calls and drifts as the connector evolves. The source operations layer makes
that drift structurally hard: each migrated connector has one conspicuous
gateway cl... | 315 | 13,701 |
onyx | backend/onyx/connectors/exceptions.py | .py | class ValidationError(Exception):
"""General exception for validation errors."""
def __init__(self, message: str):
self.message = message
super().__init__(self.message)
class ConnectorValidationError(ValidationError):
"""General exception for connector validation errors."""
def __ini... | 53 | 1,713 |
onyx | backend/onyx/connectors/models.py | .py | import hashlib
import json
import sys
from collections.abc import Sequence
from datetime import datetime
from enum import Enum
from typing import Any, Literal, cast
from pydantic import BaseModel, Field, field_validator, model_validator
from onyx.access.models import ExternalAccess
from onyx.configs.constants import ... | 592 | 20,718 |
onyx | backend/onyx/connectors/connector_runner.py | .py | import sys
import time
from collections.abc import Generator
from datetime import datetime
from typing import Generic, TypeVar
from onyx.connectors.interfaces import (
BaseConnector,
CheckpointedConnector,
CheckpointedConnectorWithPermSync,
CheckpointOutput,
LoadConnector,
PollConnector,
)
from... | 294 | 11,087 |
onyx | backend/onyx/connectors/registry.py | .py | """Registry mapping for connector classes."""
from pydantic import BaseModel
from onyx.configs.constants import DocumentSource
class ConnectorMapping(BaseModel):
module_path: str
class_name: str
# Mapping of DocumentSource to connector details for lazy loading
CONNECTOR_CLASS_MAP = {
DocumentSource.WE... | 237 | 8,568 |
onyx | backend/onyx/connectors/credentials_provider.py | .py | import uuid
from types import TracebackType
from typing import Any
from redis.lock import Lock as RedisLock
from sqlalchemy import select
from onyx.configs.constants import DocumentSource
from onyx.connectors.interfaces import CredentialsProviderInterface
from onyx.db.engine.sql_engine import get_session_with_tenant
... | 168 | 5,786 |
onyx | backend/onyx/connectors/capabilities.py | .py | """Shared capability vocabulary for connectors.
A leaf module: both the capability-check framework and the source-operations
layer tag things with capabilities, and neither may import the other for it.
"""
from enum import Enum
class CredentialCapability(str, Enum):
"""
User-visible capabilities a credentia... | 18 | 490 |
onyx | backend/onyx/connectors/factory.py | .py | import importlib
from typing import Any, Type
from sqlalchemy.orm import Session
from onyx.configs.app_configs import INTEGRATION_TESTS_MODE
from onyx.configs.constants import DocumentSource
from onyx.configs.llm_configs import get_image_extraction_and_analysis_enabled
from onyx.connectors.credentials_provider import... | 197 | 6,431 |
onyx | backend/onyx/connectors/interfaces.py | .py | import abc
from collections.abc import Generator, Iterator
from types import TracebackType
from typing import Any, Generic, TypeAlias, TypeVar
from pydantic import BaseModel, Field
from onyx.configs.constants import DocumentSource
from onyx.connectors.models import (
ConnectorCheckpoint,
ConnectorFailure,
... | 342 | 11,552 |
onyx | backend/onyx/connectors/microsoft_graph_env.py | .py | """Inverse mapping from user-facing Microsoft host URLs to the SDK's AzureEnvironment.
The office365 library's GraphClient requires an ``AzureEnvironment`` string
(e.g. ``"Global"``, ``"GCC High"``) to route requests to the correct national
cloud. Our connectors instead expose free-text ``authority_host`` and
``graph... | 96 | 3,480 |
onyx | backend/onyx/connectors/drupal_wiki/utils.py | .py | from onyx.utils.logger import setup_logger
logger = setup_logger()
def build_drupal_wiki_document_id(base_url: str, page_id: int) -> str:
"""Build a document ID for a Drupal Wiki page using the real URL format"""
# Ensure base_url ends with a slash
base_url = base_url.rstrip("/") + "/"
return f"{base... | 11 | 341 |
onyx | backend/onyx/connectors/drupal_wiki/models.py | .py | from enum import Enum
from typing import Generic, List, Optional, TypeVar
from pydantic import BaseModel
from onyx.connectors.interfaces import ConnectorCheckpoint
class SpaceAccessStatus(str, Enum):
"""Enum for Drupal Wiki space access status"""
PRIVATE = "PRIVATE"
ANONYMOUS = "ANONYMOUS"
AUTHENTI... | 73 | 1,646 |
onyx | backend/onyx/connectors/drupal_wiki/connector.py | .py | import mimetypes
from io import BytesIO
from typing import Any
import requests
from typing_extensions import override
from onyx.configs.app_configs import (
CONTINUE_ON_CONNECTOR_FAILURE,
DRUPAL_WIKI_ATTACHMENT_SIZE_THRESHOLD,
INDEX_BATCH_SIZE,
)
from onyx.configs.constants import DocumentSource, FileOrig... | 985 | 38,505 |
onyx | backend/onyx/connectors/mediawiki/wiki.py | .py | from __future__ import annotations
import datetime
import itertools
import tempfile
from collections.abc import Iterator
from typing import Any, ClassVar, cast
import pywikibot.config
import pywikibot.time
from pywikibot import pagegenerators, textlib
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.c... | 250 | 8,371 |
onyx | backend/onyx/connectors/mediawiki/family.py | .py | from __future__ import annotations
import builtins
import functools
import itertools
import tempfile
from typing import Any
from unittest import mock
from urllib.parse import urlparse, urlunparse
from pywikibot import family, pagegenerators
from pywikibot.scripts import generate_family_file
from pywikibot.scripts.gen... | 169 | 5,350 |
onyx | backend/onyx/connectors/testrail/connector.py | .py | from __future__ import annotations
from collections.abc import Iterator
from datetime import datetime, timezone
from typing import Any, ClassVar, Optional
import requests
from bs4 import BeautifulSoup
from onyx.configs.app_configs import INDEX_BATCH_SIZE, REQUEST_TIMEOUT_SECONDS
from onyx.configs.constants import Do... | 580 | 22,090 |
onyx | backend/onyx/connectors/google_drive/doc_conversion.py | .py | import io
from collections.abc import Callable
from datetime import datetime
from typing import Any, cast
from urllib.parse import urlparse, urlunparse
from googleapiclient.errors import HttpError
from googleapiclient.http import MediaIoBaseDownload
from pydantic import BaseModel
from onyx.access.models import Extern... | 1,000 | 37,520 |
onyx | backend/onyx/connectors/google_drive/models.py | .py | from enum import Enum
from typing import Any
from pydantic import BaseModel, ConfigDict, Field, field_serializer, field_validator
from onyx.connectors.interfaces import ConnectorCheckpoint, SecondsSinceUnixEpoch
from onyx.utils.threadpool_concurrency import ThreadSafeDict, ThreadSafeSet
class GDriveMimeType(str, En... | 240 | 9,206 |
onyx | backend/onyx/connectors/google_drive/section_extraction.py | .py | import json
from typing import Any
from google.auth.transport.requests import AuthorizedSession
from pydantic import BaseModel
from onyx.connectors.models import TextSection
HEADING_DELIMITER = "\n"
class CurrentHeading(BaseModel):
id: str | None
text: str
def _build_gdoc_section_link(doc_id: str, tab_id... | 201 | 6,849 |
onyx | backend/onyx/connectors/google_drive/constants.py | .py | UNSUPPORTED_FILE_TYPE_CONTENT = "" # keep empty for now
DRIVE_FOLDER_TYPE = "application/vnd.google-apps.folder"
DRIVE_SHORTCUT_TYPE = "application/vnd.google-apps.shortcut"
DRIVE_FILE_TYPE = "application/vnd.google-apps.file"
| 5 | 228 |
onyx | backend/onyx/connectors/google_drive/connector.py | .py | import copy
import json
import os
import sys
import threading
from collections.abc import Callable, Generator, Iterator
from datetime import datetime
from enum import Enum
from typing import Any, Protocol, cast
from urllib.parse import ParseResult, parse_qs, urlparse
from google.auth.exceptions import RefreshError
fro... | 2,428 | 101,769 |
onyx | backend/onyx/connectors/google_drive/file_retrieval.py | .py | from collections.abc import Callable, Iterator
from datetime import datetime, timezone
from enum import Enum
from typing import Any, cast
from urllib.parse import parse_qs, urlparse
from google.auth.exceptions import RefreshError
from googleapiclient.discovery import Resource
from googleapiclient.errors import HttpErr... | 839 | 29,454 |
onyx | backend/onyx/connectors/gitlab/connector.py | .py | import fnmatch
import itertools
from collections import deque
from collections.abc import Iterable, Iterator
from datetime import datetime, timezone
from typing import Any, TypeVar
import gitlab
import pytz
from gitlab.v4.objects import Project
from onyx.configs.app_configs import (
GITLAB_CONNECTOR_INCLUDE_CODE_... | 295 | 10,632 |
onyx | backend/onyx/connectors/slab/connector.py | .py | import json
from collections.abc import Callable, Generator
from datetime import datetime, timezone
from typing import Any
from urllib.parse import urljoin
import requests
from dateutil import parser
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.conn... | 316 | 10,438 |
onyx | backend/onyx/connectors/airtable/airtable_connector.py | .py | import contextvars
import re
from concurrent.futures import Future, ThreadPoolExecutor, as_completed
from io import BytesIO
from typing import Any, cast
import requests
from pyairtable import Api as AirtableApi
from pyairtable.api.types import RecordDict
from pyairtable.models.schema import TableSchema
from onyx.conf... | 641 | 24,237 |
onyx | backend/onyx/connectors/wikipedia/connector.py | .py | from typing import ClassVar
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.mediawiki import wiki
class WikipediaConnector(wiki.MediaWikiConnector):
"""Connector for Wikipedia."""
document_source_type: ClassVar[DocumentSource] = Do... | 29 | 806 |
onyx | backend/onyx/connectors/outline/connector.py | .py | import html
import time
from collections.abc import Callable
from typing import Any
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc
from onyx.connectors.exceptions import (
... | 240 | 8,773 |
onyx | backend/onyx/connectors/outline/client.py | .py | from typing import Any
import requests
from requests.exceptions import ConnectionError as RequestsConnectionError
from requests.exceptions import RequestException, Timeout
from onyx.configs.app_configs import REQUEST_TIMEOUT_SECONDS
class OutlineClientRequestFailedError(ConnectionError):
"""Custom error class f... | 86 | 3,228 |
onyx | backend/onyx/connectors/bookstack/connector.py | .py | import html
import time
from collections.abc import Callable
from datetime import datetime, timezone
from typing import Any
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.bookstack.client import (
BookStackApiClient,
BookStackClientR... | 307 | 11,511 |
onyx | backend/onyx/connectors/bookstack/client.py | .py | from typing import Any
import requests
from onyx.configs.app_configs import REQUEST_TIMEOUT_SECONDS
class BookStackClientRequestFailedError(ConnectionError):
def __init__(self, status: int, error: str) -> None:
self.status_code = status
self.error = error
super().__init__(
"B... | 63 | 1,878 |
onyx | backend/onyx/connectors/asana/connector.py | .py | import datetime
from typing import Any
from onyx.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE, INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.asana import asana_api
from onyx.connectors.interfaces import (
GenerateDocumentsOutput,
LoadConnector,
PollConn... | 134 | 4,774 |
onyx | backend/onyx/connectors/asana/asana_api.py | .py | import time
from collections.abc import Iterator
from datetime import datetime
from typing import Dict
import asana
from onyx.utils.logger import setup_logger
logger = setup_logger()
# https://github.com/Asana/python-asana/tree/master?tab=readme-ov-file#documentation-for-api-endpoints
class AsanaTask:
def __in... | 275 | 10,075 |
onyx | backend/onyx/connectors/gong/connector.py | .py | import base64
import copy
import time
from collections.abc import Generator
from datetime import datetime, timedelta, timezone
from typing import Any, cast
from urllib.parse import urlparse
import requests
from pydantic import BaseModel
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
from ony... | 652 | 26,425 |
onyx | backend/onyx/connectors/document360/utils.py | .py | def flatten_child_categories(category: dict) -> list[dict]:
if not category["child_categories"]:
return [category]
else:
flattened_categories = [category]
for child_category in category["child_categories"]:
flattened_categories.extend(flatten_child_categories(child_category))... | 9 | 357 |
onyx | backend/onyx/connectors/document360/connector.py | .py | from datetime import datetime, timezone
from typing import Any, List, Optional
import requests
from onyx.configs.app_configs import INDEX_BATCH_SIZE, REQUEST_TIMEOUT_SECONDS
from onyx.configs.constants import DocumentSource
from onyx.connectors.cross_connector_utils.rate_limit_wrapper import rate_limit_builder
from o... | 218 | 8,101 |
onyx | backend/onyx/connectors/gmail/connector.py | .py | from base64 import urlsafe_b64decode
from collections.abc import Callable, Iterator
from typing import Any, Dict, cast
from google.oauth2.credentials import Credentials as OAuthCredentials
from google.oauth2.service_account import Credentials as ServiceAccountCredentials
from googleapiclient.errors import HttpError
f... | 674 | 23,539 |
onyx | backend/onyx/connectors/teams/utils.py | .py | import random
import time
from collections.abc import Generator
from datetime import datetime, timezone
from typing import Any
from office365.graph_client import GraphClient
from office365.runtime.client_request_exception import ClientRequestException
from office365.runtime.queries.client_query import ClientQuery
from... | 302 | 9,943 |
onyx | backend/onyx/connectors/teams/models.py | .py | from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
class Body(BaseModel):
content_type: str
content: str | None
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
)
class User(BaseM... | 52 | 1,043 |
onyx | backend/onyx/connectors/teams/connector.py | .py | import copy
import os
from collections.abc import Iterator
from datetime import datetime, timezone
from functools import partial
from typing import Any
import msal
from office365.graph_client import GraphClient
from office365.runtime.client_request_exception import ClientRequestException
from office365.runtime.http.re... | 881 | 31,149 |
onyx | backend/onyx/connectors/clickup/connector.py | .py | from datetime import datetime, timezone
from typing import Any, Optional
import requests
from onyx.configs.app_configs import INDEX_BATCH_SIZE, REQUEST_TIMEOUT_SECONDS
from onyx.configs.constants import DocumentSource
from onyx.connectors.cross_connector_utils.rate_limit_wrapper import rate_limit_builder
from onyx.co... | 232 | 8,101 |
onyx | backend/onyx/connectors/dropbox/connector.py | .py | from io import BytesIO
from typing import Any
from dropbox import Dropbox
from dropbox.exceptions import ApiError, AuthError
from dropbox.files import FileMetadata, FolderMetadata
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.exceptions im... | 182 | 6,694 |
onyx | backend/onyx/connectors/google_site/connector.py | .py | import os
import re
from typing import Any, cast
from bs4 import BeautifulSoup, Tag
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.interfaces import GenerateDocumentsOutput, LoadConnector
from onyx.connectors.models import Document, Hierarc... | 140 | 4,770 |
onyx | backend/onyx/connectors/highspot/utils.py | .py | from typing import Optional
from urllib.parse import urlparse
from bs4 import BeautifulSoup
from playwright.sync_api import sync_playwright
from onyx.file_processing.html_utils import web_html_cleanup
from onyx.utils.logger import setup_logger
logger = setup_logger()
# Constants
WEB_CONNECTOR_MAX_SCROLL_ATTEMPTS = ... | 123 | 4,176 |
onyx | backend/onyx/connectors/highspot/__init__.py | .py | """
Highspot connector package for Onyx.
Enables integration with Highspot's knowledge base.
"""
| 5 | 97 |
onyx | backend/onyx/connectors/highspot/connector.py | .py | import os
from datetime import datetime
from io import BytesIO
from typing import Any, Dict, List, Optional
from pydantic import BaseModel
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.highspot.client import HighspotClient, HighspotClientE... | 515 | 21,029 |
onyx | backend/onyx/connectors/highspot/client.py | .py | import base64
from typing import Any, Dict, List, Optional
from urllib.parse import urljoin
import requests
from requests.adapters import HTTPAdapter
from requests.exceptions import HTTPError, RequestException, Timeout
from urllib3.util.retry import Retry
from onyx.utils.logger import setup_logger
logger = setup_log... | 291 | 9,214 |
onyx | backend/onyx/connectors/fireflies/connector.py | .py | import time
from collections.abc import Iterator
from datetime import datetime, timezone
from typing import List, cast
import requests
from onyx.configs.app_configs import INDEX_BATCH_SIZE, REQUEST_TIMEOUT_SECONDS
from onyx.configs.constants import DocumentSource
from onyx.connectors.interfaces import (
GenerateD... | 262 | 9,147 |
onyx | backend/onyx/connectors/egnyte/connector.py | .py | import io
import os
from collections.abc import Generator
from datetime import datetime, timezone
from typing import IO, Any
from urllib.parse import quote
from pydantic import Field
from onyx.configs.app_configs import (
EGNYTE_CLIENT_ID,
EGNYTE_CLIENT_SECRET,
INDEX_BATCH_SIZE,
)
from onyx.configs.consta... | 370 | 12,319 |
onyx | backend/onyx/connectors/confluence/user_profile_override.py | .py | from onyx.connectors.confluence.models import ConfluenceUser
def process_confluence_user_profiles_override(
confluence_user_email_override: list[dict[str, str]],
) -> list[ConfluenceUser]:
return [
ConfluenceUser(
user_id=override["user_id"],
# username is not returned by the C... | 19 | 618 |
onyx | backend/onyx/connectors/confluence/utils.py | .py | import math
import time
from collections.abc import Callable
from datetime import datetime, timedelta, timezone
from io import BytesIO
from pathlib import Path
from typing import TYPE_CHECKING, Any, TypeVar, cast
from urllib.parse import parse_qs, quote, urljoin, urlparse
import requests
from pydantic import BaseModel... | 481 | 16,987 |
onyx | backend/onyx/connectors/confluence/models.py | .py | from pydantic import BaseModel
class ConfluenceUser(BaseModel):
user_id: str # accountId in Cloud, userKey in Server
username: str | None # Confluence Cloud doesn't give usernames
display_name: str
# Confluence Data Center doesn't give email back by default,
# have to fetch it with a different e... | 12 | 364 |
onyx | backend/onyx/connectors/confluence/connector.py | .py | import copy
import re
from collections.abc import Generator, Iterable
from datetime import datetime, timedelta, timezone
from typing import Any
from urllib.parse import quote
from atlassian.errors import ApiError
from requests.exceptions import HTTPError
from typing_extensions import override
from onyx.access.models ... | 1,482 | 60,026 |
onyx | backend/onyx/connectors/confluence/onyx_confluence.py | .py | """
# README (notes on Confluence pagination):
We've noticed that the `search/users` and `users/memberof` endpoints for Confluence Cloud use offset-based pagination as
opposed to cursor-based. We also know that page-retrieval uses cursor-based pagination.
Our default pagination strategy right now for cloud is to assu... | 1,557 | 63,629 |
onyx | backend/onyx/connectors/confluence/access.py | .py | from collections.abc import Callable
from typing import Any, cast
from onyx.access.models import ExternalAccess
from onyx.connectors.confluence.onyx_confluence import OnyxConfluence
from onyx.utils.variable_functionality import (
fetch_versioned_implementation,
global_version,
)
def get_page_restrictions(
... | 121 | 3,830 |
onyx | backend/onyx/connectors/discord/connector.py | .py | import asyncio
from collections.abc import AsyncGenerator, AsyncIterable, Iterable
from datetime import datetime, timezone
from typing import Any, cast
from discord import Client
from discord.channel import TextChannel, Thread
from discord.enums import MessageType
from discord.errors import LoginFailure
from discord.f... | 368 | 12,481 |
onyx | backend/onyx/connectors/canvas/connector.py | .py | import time
from datetime import datetime, timezone
from enum import StrEnum
from typing import Any, NoReturn, cast
from pydantic import BaseModel, Field
from typing_extensions import override
from onyx.access.models import ExternalAccess
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constan... | 1,054 | 39,112 |
onyx | backend/onyx/connectors/canvas/client.py | .py | from __future__ import annotations
import logging
import re
from collections.abc import Iterator
from typing import Any
from urllib.parse import urlparse
from onyx.connectors.cross_connector_utils.rate_limit_wrapper import rl_requests
from onyx.error_handling.error_codes import OnyxErrorCode
from onyx.error_handling.... | 214 | 8,535 |
onyx | backend/onyx/connectors/canvas/access.py | .py | from collections.abc import Callable
from typing import Any, cast
from onyx.access.models import ExternalAccess
from onyx.connectors.canvas.client import CanvasApiClient
from onyx.utils.variable_functionality import (
fetch_versioned_implementation,
global_version,
)
def get_course_permissions(
canvas_cl... | 97 | 2,669 |
onyx | backend/onyx/connectors/google_utils/google_kv.py | .py | import json
from datetime import datetime, timedelta, timezone
from typing import Any, cast
from urllib.parse import ParseResult, parse_qs, urlparse
from google.oauth2.credentials import Credentials as OAuthCredentials
from google_auth_oauthlib.flow import InstalledAppFlow
from sqlalchemy.orm import Session
from onyx... | 294 | 10,721 |
onyx | backend/onyx/connectors/google_utils/google_utils.py | .py | import re
import socket
import ssl
import time
from collections.abc import Callable, Iterator
from datetime import datetime, timezone
from enum import Enum
from typing import Any
from googleapiclient.errors import HttpError
from onyx.connectors.google_drive.models import GoogleDriveFileType
from onyx.utils.logger imp... | 285 | 10,364 |
onyx | backend/onyx/connectors/google_utils/google_auth.py | .py | import json
from typing import Any
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials as OAuthCredentials
from google.oauth2.service_account import Credentials as ServiceAccountCredentials
from onyx.configs.app_configs import (
OAUTH_GOOGLE_DRIVE_CLIENT_ID,
OA... | 172 | 6,536 |
onyx | backend/onyx/connectors/google_utils/shared_constants.py | .py | from enum import Enum as PyEnum
from onyx.configs.constants import DocumentSource
# NOTE: do not need https://www.googleapis.com/auth/documents.readonly
# this is counted under `/auth/drive.readonly`
GOOGLE_SCOPES = {
DocumentSource.GOOGLE_DRIVE: [
"https://www.googleapis.com/auth/drive.readonly",
... | 58 | 2,280 |
onyx | backend/onyx/connectors/google_utils/resources.py | .py | from collections.abc import Callable
from google.auth.exceptions import RefreshError
from google.auth.transport.requests import AuthorizedSession
from google.oauth2.credentials import Credentials as OAuthCredentials
from google.oauth2.service_account import Credentials as ServiceAccountCredentials
from googleapiclient... | 136 | 4,219 |
onyx | backend/onyx/connectors/loopio/connector.py | .py | import json
from collections.abc import Generator
from datetime import datetime, timezone
from typing import Any
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from... | 241 | 9,306 |
onyx | backend/onyx/connectors/mock_connector/connector.py | .py | from typing import Any
import httpx
from pydantic import BaseModel
from typing_extensions import override
from onyx.access.models import ExternalAccess
from onyx.connectors.interfaces import (
CheckpointedConnectorWithPermSync,
CheckpointOutput,
SecondsSinceUnixEpoch,
)
from onyx.connectors.models import ... | 139 | 4,798 |
onyx | backend/onyx/connectors/cross_connector_utils/miscellaneous_utils.py | .py | import re
from collections.abc import Callable, Iterator
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from typing import Any, TypeVar
from urllib.parse import urljoin, urlparse
import requests
from dateutil.parser import parse
from onyx.configs.app_configs import CONNECTOR_LOC... | 214 | 6,814 |
onyx | backend/onyx/connectors/cross_connector_utils/tabular_section_utils.py | .py | import csv
import io
from typing import IO
from pydantic import BaseModel
from onyx.connectors.models import TabularSection
from onyx.file_processing.extract_file_text import file_io_to_text, stage_xlsx_sheets
from onyx.file_processing.file_types import OnyxFileExtensions
from onyx.file_store.staging import RawFileCa... | 103 | 3,078 |
onyx | backend/onyx/connectors/cross_connector_utils/section_utils.py | .py | from onyx.configs.app_configs import CONNECTOR_MAX_EXTRACTED_TEXT_CHARS
from onyx.connectors.models import ImageSection, TabularSection, TextSection
from onyx.utils.logger import setup_logger
logger = setup_logger()
def cap_sections_text(
sections: list[TextSection | ImageSection | TabularSection],
file_name... | 40 | 1,576 |
onyx | backend/onyx/connectors/cross_connector_utils/rate_limit_wrapper.py | .py | import time
from collections.abc import Callable
from functools import wraps
from typing import Any, TypeVar, cast
import requests
from onyx.utils.logger import setup_logger
from onyx.utils.retry_after import parse_retry_after_seconds
logger = setup_logger()
F = TypeVar("F", bound=Callable[..., Any])
class RateL... | 132 | 4,135 |
onyx | backend/onyx/connectors/sharepoint/connector.py | .py | import base64
import copy
import fnmatch
import html
import io
import os
import random
import re
import time
from collections import deque
from collections.abc import Callable, Generator, Iterable
from datetime import datetime, timezone
from enum import Enum
from typing import Any, cast
from urllib.parse import quote, ... | 3,707 | 149,678 |
onyx | backend/onyx/connectors/sharepoint/connector_utils.py | .py | from typing import Any
from office365.graph_client import GraphClient
from office365.onedrive.driveitems.driveItem import DriveItem
from office365.sharepoint.client_context import ClientContext
from pydantic import BaseModel, Field, field_serializer
from onyx.connectors.models import ExternalAccess
from onyx.db.enums... | 104 | 3,000 |
onyx | backend/onyx/connectors/lumapps/utils.py | .py | import re
from typing import Any
from bs4 import BeautifulSoup
# Keys whose values hold renderable widget text inside a LumApps content template.
_CONTENT_KEYS = {"html", "content", "longText", "text", "body", "value"}
# A language-code key in a LumApps localized value: "en", "fr", "en-US", "pt_BR".
_LANG_CODE_RE = ... | 121 | 4,378 |
onyx | backend/onyx/connectors/lumapps/connector.py | .py | from datetime import datetime, timezone
from typing import Any
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.exceptions import (
ConnectorValidationError,
CredentialExpiredError,
InsufficientPermissionsError,
)
from onyx.connect... | 376 | 15,725 |
onyx | backend/onyx/connectors/lumapps/client.py | .py | import base64
import time
from typing import Any
import requests
from onyx.utils.logger import setup_logger
from onyx.utils.retry_after import parse_retry_after_seconds
logger = setup_logger()
# The documented public API lives under the legacy lumsites path on the customer cell.
LEGACY_PREFIX = "/_ah/api/lumsites/v... | 209 | 8,588 |
onyx | backend/onyx/connectors/jira/utils.py | .py | """Module with custom fields processing functions"""
import os
from typing import Any, List
from urllib.parse import urlparse
from jira import JIRA
from jira.resources import CustomFieldOption, Issue, User
from onyx.connectors.cross_connector_utils.miscellaneous_utils import scoped_url
from onyx.connectors.models im... | 239 | 7,774 |
onyx | backend/onyx/connectors/jira/connector.py | .py | import copy
import json
import os
from collections.abc import Callable, Generator, Iterable, Iterator
from datetime import datetime, timedelta, timezone
from typing import Any
import requests
from jira import JIRA
from jira.exceptions import JIRAError
from jira.resources import Issue
from more_itertools import chunked... | 1,158 | 43,984 |
onyx | backend/onyx/connectors/jira/access.py | .py | """
Permissioning / AccessControl logic for JIRA Projects + Issues.
"""
from collections.abc import Callable
from typing import cast
from jira import JIRA
from onyx.access.models import ExternalAccess
from onyx.utils.variable_functionality import (
fetch_versioned_implementation,
global_version,
)
def get_... | 56 | 1,518 |
onyx | backend/onyx/connectors/box/models.py | .py | from pydantic import BaseModel, Field
from onyx.access.models import ExternalAccess
from onyx.connectors.models import ConnectorCheckpoint
class BoxFolderFrontierEntry(BaseModel):
folder_id: str
display_name: str
parent_folder_id: str | None = None
path: str
# While queued: access inherited from ... | 28 | 1,138 |
onyx | backend/onyx/connectors/box/connector.py | .py | from collections import deque
from collections.abc import Generator
from copy import deepcopy
from datetime import datetime, timezone
from io import BytesIO
from typing import Any
from urllib.parse import urlparse
from box_sdk_gen import BoxCCGAuth, BoxClient, CCGConfig
from box_sdk_gen.box.errors import BoxAPIError
f... | 949 | 36,437 |
onyx | backend/onyx/connectors/box/access.py | .py | from collections.abc import Callable
from typing import cast
from box_sdk_gen import BoxClient
from box_sdk_gen.schemas.file_full import FileFull
from box_sdk_gen.schemas.folder_mini import FolderMini
from box_sdk_gen.schemas.web_link import WebLink
from onyx.access.models import ExternalAccess
from onyx.utils.variab... | 80 | 2,565 |
onyx | backend/onyx/connectors/guru/connector.py | .py | import json
from datetime import datetime, timezone
from typing import Any
import requests
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc
from onyx.connectors.interfaces impor... | 175 | 6,306 |
onyx | backend/onyx/connectors/gitbook/connector.py | .py | from datetime import datetime, timezone
from typing import Any
from urllib.parse import urljoin
import requests
from onyx.configs.app_configs import INDEX_BATCH_SIZE, REQUEST_TIMEOUT_SECONDS
from onyx.configs.constants import DocumentSource
from onyx.connectors.interfaces import (
GenerateDocumentsOutput,
Loa... | 309 | 10,873 |
onyx | backend/onyx/connectors/hubspot/connector.py | .py | import re
import time
from collections.abc import Callable, Generator
from datetime import datetime, timezone
from typing import Any, TypeVar, cast
import requests
from hubspot import HubSpot
from hubspot.crm.companies.models import (
BatchReadInputSimplePublicObjectId as CompaniesBatchReadInput,
)
from hubspot.cr... | 1,288 | 49,609 |
onyx | backend/onyx/connectors/hubspot/rate_limit.py | .py | from __future__ import annotations
import time
from collections.abc import Callable
from typing import Any, TypeVar
from onyx.connectors.cross_connector_utils.rate_limit_wrapper import (
RateLimitTriedTooManyTimesError,
rate_limit_builder,
)
from onyx.utils.logger import setup_logger
from onyx.utils.retry_aft... | 139 | 4,529 |
onyx | backend/onyx/connectors/slack/source_operations.py | .py | """Slack source-operations gateway: every Slack API call lives here.
This is the single file in ``onyx/connectors/slack/`` and
``ee/onyx/external_permissions/slack/`` allowed to import ``slack_sdk`` (the
import-fence test enforces it). It owns client construction -- one
redis-coordinated path shared by indexing, perm-... | 840 | 30,057 |
onyx | backend/onyx/connectors/slack/utils.py | .py | import re
from collections.abc import Callable
from functools import lru_cache
from onyx.connectors.models import BasicExpertInfo
from onyx.connectors.slack.models import MessageType
from onyx.connectors.slack.source_operations import (
SlackApiError,
SlackSourceOperations,
SlackUserInfoResponse,
)
from on... | 265 | 9,967 |
onyx | backend/onyx/connectors/slack/models.py | .py | from typing import NotRequired
from typing_extensions import TypedDict
class ChannelTopicPurposeType(TypedDict):
"""
Represents the topic or purpose of a Slack channel.
"""
value: str
creator: str
last_set: int
class ChannelType(TypedDict):
"""
Represents a Slack channel.
"""
... | 99 | 2,058 |
onyx | backend/onyx/connectors/slack/connector.py | .py | import contextvars
import copy
import itertools
import re
import threading
from collections.abc import Callable, Generator
from concurrent.futures import Future, ThreadPoolExecutor, as_completed
from datetime import datetime, timezone
from enum import Enum
from typing import Any, cast
from urllib.parse import urlparse
... | 1,599 | 60,634 |
onyx | backend/onyx/connectors/slack/capability_checks.py | .py | """Capability checks for the Slack connector.
Each check probes one permission assumption the connector makes at indexing or
doc-permission-sync time by composing the same gateway operations production
code calls (``limit=1`` where possible). Checks need no connector instance: the
runner constructs the registered ``Sl... | 883 | 35,226 |
onyx | backend/onyx/connectors/slack/access.py | .py | from collections.abc import Callable
from typing import cast
from onyx.access.models import ExternalAccess
from onyx.connectors.models import BasicExpertInfo
from onyx.connectors.slack.models import ChannelType
from onyx.connectors.slack.source_operations import SlackSourceOperations
from onyx.utils.variable_functiona... | 47 | 1,479 |
onyx | backend/onyx/connectors/salesforce/doc_conversion.py | .py | import re
from typing import Any, cast
from onyx.configs.constants import DocumentSource
from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc
from onyx.connectors.models import BasicExpertInfo, Document, ImageSection, TextSection
from onyx.connectors.salesforce.onyx_salesforce import O... | 251 | 9,092 |
onyx | backend/onyx/connectors/salesforce/utils.py | .py | import os
import re
from dataclasses import dataclass
from typing import Any
NAME_FIELD = "Name"
MODIFIED_FIELD = "LastModifiedDate"
CREATED_FIELD = "CreatedDate"
ID_FIELD = "Id"
ACCOUNT_OBJECT_TYPE = "Account"
USER_OBJECT_TYPE = "User"
# Salesforce object and field API names must start with a letter and contain
# on... | 126 | 3,790 |
onyx | backend/onyx/connectors/salesforce/salesforce_calls.py | .py | import gc
import os
import time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from pytz import UTC
from simple_salesforce import Salesforce
from simple_salesforce.bulk2 import SFBulk2Handler, SFBulk2Type
from simple_salesforce.exceptions import SalesforceRefusedRequest
from simple_sal... | 271 | 9,450 |
onyx | backend/onyx/connectors/salesforce/sqlite_functions.py | .py | import csv
import json
import os
import sqlite3
import time
from collections.abc import Iterator
from pathlib import Path
from typing import Any, cast
from onyx.connectors.models import BasicExpertInfo
from onyx.connectors.salesforce.utils import (
ACCOUNT_OBJECT_TYPE,
ID_FIELD,
NAME_FIELD,
USER_OBJECT... | 827 | 31,603 |
onyx | backend/onyx/connectors/salesforce/blacklist.py | .py | # NOTE(rkuo): I can't find an actual API that allows us to distinguish
# broken/incompatible objects from regular ones.
# taking hints from
# https://docs.resco.net/wiki/Salesforce_object_blacklist
SALESFORCE_BLACKLISTED_PREFIXES: set[str] = set(
[
"process",
"aura",
"app",
"auth",
... | 345 | 9,582 |
onyx | backend/onyx/connectors/salesforce/connector.py | .py | import csv
import gc
import json
import os
import sys
import tempfile
import time
from collections import defaultdict
from collections.abc import Callable
from pathlib import Path
from typing import Any
from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.connectors.cross_connector_utils.miscellaneous_utils... | 1,285 | 50,638 |
onyx | backend/onyx/connectors/salesforce/onyx_salesforce.py | .py | import time
from typing import Any
from requests.adapters import HTTPAdapter
from simple_salesforce import Salesforce, SFType
from simple_salesforce.exceptions import SalesforceRefusedRequest
from simple_salesforce.format import format_soql
from urllib3.util.retry import Retry
from onyx.connectors.cross_connector_uti... | 431 | 16,465 |
onyx | backend/onyx/connectors/salesforce/shelve_stuff/old_test_salesforce_shelves.py | .py | import csv
import os
import shutil
from onyx.connectors.salesforce.shelve_stuff.shelve_functions import (
find_ids_by_type,
get_affected_parent_ids_by_type,
get_child_ids,
get_record,
update_sf_db_with_csv,
)
from onyx.connectors.salesforce.utils import BASE_DATA_PATH, get_object_type_path
_VALID_... | 735 | 24,707 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.