id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
16,801 | from mmcv.utils import Registry
from mmdet.models.builder import BACKBONES, HEADS, LOSSES, NECKS
def build_fusion_model(cfg, train_cfg=None, test_cfg=None):
return FUSIONMODELS.build(
cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg)
)
def build_model(cfg, train_cfg=None, test_cfg=None):
... | null |
16,802 | import copy
import numpy as np
import torch
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_conv_layer
from mmcv.runner import force_fp32
from torch import nn
from mmdet3d.core import (
PseudoSampler,
circle_nms,
draw_heatmap_gaussian,
gaussian_radius,
xywhr2xyxyr,
)
from mmde... | null |
16,803 | import copy
import torch
from mmcv.cnn import ConvModule, build_conv_layer
from mmcv.runner import BaseModule, force_fp32
from torch import nn
from mmdet3d.core import circle_nms, draw_heatmap_gaussian, gaussian_radius, xywhr2xyxyr
from mmdet3d.models import builder
from mmdet3d.models.builder import HEADS, build_loss
... | null |
16,804 | from typing import Any, Dict, List, Optional, Tuple, Union
import torch
from torch import nn
from torch.nn import functional as F
from mmdet3d.models.builder import HEADS
def sigmoid_xent_loss(
inputs: torch.Tensor,
targets: torch.Tensor,
reduction: str = "mean",
) -> torch.Tensor:
inputs = inputs.floa... | null |
16,805 | from typing import Any, Dict, List, Optional, Tuple, Union
import torch
from torch import nn
from torch.nn import functional as F
from mmdet3d.models.builder import HEADS
def sigmoid_focal_loss(
inputs: torch.Tensor,
targets: torch.Tensor,
alpha: float = -1,
gamma: float = 2,
reduction: str = "mean... | null |
16,806 | from mmcv.cnn import ConvModule, build_conv_layer, kaiming_init
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn import Linear
from torch.nn.init import xavier_uniform_, constant_
The provided code snippet includes necessary dependencies for imple... | r""" Args: query, key, value: map a query and a set of key-value pairs to an output. See "Attention Is All You Need" for more details. embed_dim_to_check: total dimension of the model. num_heads: parallel attention heads. in_proj_weight, in_proj_bias: input projection weight and bias. bias_k, bias_v: bias of the key an... |
16,807 | import torch
import torch.nn as nn
from mmdet.models.backbones.swin import WindowMSA, ShiftWindowMSA
from mmdet3d.ops.spconv import SparseConv3d, SubMConv3d
from mmdet3d.models.utils.transformer import MultiheadAttention
from typing import Union
from thop import profile
def count_window_msa(m: Union[WindowMSA, ShiftWin... | null |
16,808 | import copy
import torch
from collections import deque
def convert_sync_batchnorm(input_model, exclude=[]):
for name, module in input_model._modules.items():
skip = sum([ex in name for ex in exclude])
if skip:
continue
input_model._modules[name] = torch.nn.SyncBatchNorm.convert_... | null |
16,809 | import copy
def recursive_eval(obj, globals=None):
if globals is None:
globals = copy.deepcopy(obj)
if isinstance(obj, dict):
for key in obj:
obj[key] = recursive_eval(obj[key], globals)
elif isinstance(obj, list):
for k, val in enumerate(obj):
obj[k] = recu... | null |
16,810 | import logging
from mmcv.utils import get_logger
The provided code snippet includes necessary dependencies for implementing the `get_root_logger` function. Write a Python function `def get_root_logger(log_file=None, log_level=logging.INFO, name="mmdet3d")` to solve the following problem:
Get root logger and add a keyw... | Get root logger and add a keyword filter to it. The logger will be initialized if it has not been initialized. By default a StreamHandler will be added. If `log_file` is specified, a FileHandler will also be added. The name of the root logger is the top-level package name, e.g., "mmdet3d". Args: log_file (str, optional... |
16,811 | import argparse
import os
import time
import warnings
import mmcv
import onnx
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint, wrap_fp16_model
from mmdet3d.apis import single_gpu_test
f... | null |
16,812 | import argparse
from data_converter import nuscenes_converter as nuscenes_converter
from data_converter.create_gt_database import create_groundtruth_database
def create_groundtruth_database(
dataset_class_name,
data_path,
info_prefix,
info_path=None,
mask_anno_path=None,
used_classes=None,
... | Prepare data related to nuScenes dataset. Related data consists of '.pkl' files recording basic infos, 2D annotations and groundtruth database. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. version (str): Dataset version. dataset_name (str): The dataset class name. out_di... |
16,813 | import argparse
import copy
import os
import mmcv
import numpy as np
import torch
from mmcv import Config
from mmcv.parallel import MMDistributedDataParallel
from mmcv.runner import load_checkpoint
from torchpack import distributed as dist
from torchpack.utils.config import configs
from torchpack.utils.tqdm import tqdm... | null |
16,814 | import mmcv
import numpy as np
import os
from collections import OrderedDict
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.geometry_utils import view_points
from os import path as osp
from pyquaternion import Quaternion
from shapely.geometry import MultiPoint, box
from typing import List, Tuple, Union
from... | Export 2d annotation from the info file and raw data. Args: root_path (str): Root path of the raw data. info_path (str): Path of the info file. version (str): Dataset version. mono3d (bool): Whether to export mono3d annotation. Default: True. |
16,815 | import pickle
from os import path as osp
import mmcv
import numpy as np
from mmcv import track_iter_progress
from mmcv.ops import roi_align
from pycocotools import mask as maskUtils
from pycocotools.coco import COCO
from mmdet3d.core.bbox import box_np_ops as box_np_ops
from mmdet3d.datasets import build_dataset
from m... | null |
16,816 | import argparse
import time
import torch
from mmcv import Config
from mmcv.parallel import MMDataParallel
from mmcv.runner import load_checkpoint, wrap_fp16_model
from mmdet3d.datasets import build_dataloader, build_dataset
from mmdet3d.models import build_fusion_model
from torchpack.utils.config import configs
from mm... | null |
16,817 | import json
from langchain.schema import OutputParserException
def parse_json_markdown(json_string: str) -> dict:
# Remove the triple backticks if present
json_string = json_string.strip()
start_index = json_string.find("```json")
end_index = json_string.find("```", start_index + len("```json"))
if ... | null |
16,818 | import os
from functools import wraps
from flask import current_app, g, has_request_context, request
from flask_login import user_logged_in
from flask_login.config import EXEMPT_METHODS
from werkzeug.exceptions import Unauthorized
from werkzeug.local import LocalProxy
from extensions.ext_database import db
from models.... | If you decorate a view with this, it will ensure that the current user is logged in and authenticated before calling the actual view. (If they are not, it calls the :attr:`LoginManager.unauthorized` callback.) For example:: @app.route('/post') @login_required def post(): pass If there are only certain times you need to... |
16,819 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def run(script):
return subprocess.getstatusoutput('source /root/.bashrc && ' + script) | null |
16,820 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def email(email):
# Define a regex pattern for email addresses
pattern = r"^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$"
... | null |
16,821 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def uuid_value(value):
if value == '':
return str(value)
try:
uuid_obj = uuid.UUID(value)
... | null |
16,822 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def timestamp_value(timestamp):
try:
int_timestamp = int(timestamp)
if int_timestamp < 0:
... | null |
16,823 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def _get_float(value):
try:
return float(value)
except (TypeError, ValueError):
raise ValueError... | null |
16,824 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def timezone(timezone_string):
if timezone_string and timezone_string in available_timezones():
return timez... | null |
16,825 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def generate_string(n):
letters_digits = string.ascii_letters + string.digits
result = ""
for i in range(n):... | null |
16,826 | import random
import re
import string
import subprocess
import uuid
from datetime import datetime
from hashlib import sha256
from zoneinfo import available_timezones
from flask_restful import fields
def get_remote_ip(request):
if request.headers.get('CF-Connecting-IP'):
return request.headers.get('Cf-Conne... | null |
16,827 | import base64
import binascii
import hashlib
import re
def hash_password(password_str, salt_byte):
def compare_password(password_str, password_hashed_base64, salt_base64):
# compare password for login
return hash_password(password_str, base64.b64decode(salt_base64)) == base64.b64decode(password_hashed_base64) | null |
16,828 | import os
from werkzeug.exceptions import Unauthorized
import json
import logging
import threading
import time
import warnings
from flask import Flask, Response, request
from flask_cors import CORS
from commands import register_commands
from config import CloudEditionConfig, Config
from extensions import (
ext_cele... | null |
16,829 | import os
from werkzeug.exceptions import Unauthorized
import json
import logging
import threading
import time
import warnings
from flask import Flask, Response, request
from flask_cors import CORS
from commands import register_commands
from config import CloudEditionConfig, Config
from extensions import (
ext_cele... | Load user based on the request. |
16,830 | import os
from werkzeug.exceptions import Unauthorized
import json
import logging
import threading
import time
import warnings
from flask import Flask, Response, request
from flask_cors import CORS
from commands import register_commands
from config import CloudEditionConfig, Config
from extensions import (
ext_cele... | Handle unauthorized requests. |
16,831 | import os
from werkzeug.exceptions import Unauthorized
import json
import logging
import threading
import time
import warnings
from flask import Flask, Response, request
from flask_cors import CORS
from commands import register_commands
from config import CloudEditionConfig, Config
from extensions import (
ext_cele... | Add Version headers to the response. |
16,832 | import os
from werkzeug.exceptions import Unauthorized
import json
import logging
import threading
import time
import warnings
from flask import Flask, Response, request
from flask_cors import CORS
from commands import register_commands
from config import CloudEditionConfig, Config
from extensions import (
ext_cele... | null |
16,833 | import os
from werkzeug.exceptions import Unauthorized
import json
import logging
import threading
import time
import warnings
from flask import Flask, Response, request
from flask_cors import CORS
from commands import register_commands
from config import CloudEditionConfig, Config
from extensions import (
ext_cele... | null |
16,834 | import os
from werkzeug.exceptions import Unauthorized
import json
import logging
import threading
import time
import warnings
from flask import Flask, Response, request
from flask_cors import CORS
from commands import register_commands
from config import CloudEditionConfig, Config
from extensions import (
ext_cele... | null |
16,835 | from __future__ import annotations
from collections.abc import Iterable, Mapping
from typing import TypeVar
from ._base_type import NotGiven
class NotGiven(pydantic.BaseModel):
"""
A sentinel singleton class used to distinguish omitted keyword arguments
from those passed in with the value None (which may h... | null |
16,836 | from __future__ import annotations
from collections.abc import Iterable, Mapping
from typing import TypeVar
from ._base_type import NotGiven
_T = TypeVar("_T")
def flatten(t: Iterable[Iterable[_T]]) -> list[_T]:
return [item for sublist in t for item in sublist] | null |
16,837 | from __future__ import annotations
import inspect
from collections.abc import Mapping
from typing import Any, Union, cast
import httpx
import pydantic
from httpx import URL, Timeout
from . import _errors
from ._base_type import NOT_GIVEN, Body, Data, Headers, NotGiven, Query, RequestFiles, ResponseT
from ._errors impor... | null |
16,838 | from __future__ import annotations
import inspect
from collections.abc import Mapping
from typing import Any, Union, cast
import httpx
import pydantic
from httpx import URL, Timeout
from . import _errors
from ._base_type import NOT_GIVEN, Body, Data, Headers, NotGiven, Query, RequestFiles, ResponseT
from ._errors impor... | null |
16,839 | from __future__ import annotations
import io
import os
from collections.abc import Mapping, Sequence
from pathlib import Path
from ._base_type import FileTypes, HttpxFileTypes, HttpxRequestFiles, RequestFiles
def _transform_file(file: FileTypes) -> HttpxFileTypes:
if is_file_content(file):
if isinstance(fil... | null |
16,840 | import time
import cachetools.func
import jwt
API_TOKEN_TTL_SECONDS = 3 * 60
def generate_token(apikey: str):
try:
api_key, secret = apikey.split(".")
except Exception as e:
raise Exception("invalid api_key", e)
payload = {
"api_key": api_key,
"exp": int(round(time.time() *... | null |
16,841 | from pydantic import BaseModel
from core.model_runtime.entities.defaults import PARAMETER_RULE_TEMPLATE
from core.model_runtime.entities.llm_entities import LLMMode
from core.model_runtime.entities.model_entities import (
AIModelEntity,
DefaultParameterName,
FetchFrom,
I18nObject,
ModelFeature,
... | null |
16,842 | import dataclasses
import datetime
from collections import defaultdict, deque
from collections.abc import Callable
from decimal import Decimal
from enum import Enum
from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
from pathlib import Path, PurePath
from re import Pa... | null |
16,843 | import dataclasses
import datetime
from collections import defaultdict, deque
from collections.abc import Callable
from decimal import Decimal
from enum import Enum
from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
from pathlib import Path, PurePath
from re import Pa... | Encodes a Decimal as int of there's no exponent, otherwise float This is useful when we use ConstrainedDecimal to represent Numeric(x,0) where a integer (but not int typed) is used. Encoding this as a float results in failed round-tripping between encode and parse. Our Id type is a prime example of this. >>> decimal_en... |
16,844 | import dataclasses
import datetime
from collections import defaultdict, deque
from collections.abc import Callable
from decimal import Decimal
from enum import Enum
from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
from pathlib import Path, PurePath
from re import Pa... | null |
16,845 | import dataclasses
import datetime
from collections import defaultdict, deque
from collections.abc import Callable
from decimal import Decimal
from enum import Enum
from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
from pathlib import Path, PurePath
from re import Pa... | null |
16,846 | import pydantic
from pydantic import BaseModel
def dump_model(model: BaseModel) -> dict:
if hasattr(pydantic, 'model_dump'):
return pydantic.model_dump(model)
else:
return model.dict() | null |
16,847 | import enum
from typing import Any, cast
from langchain.schema import AIMessage, BaseMessage, FunctionMessage, HumanMessage, SystemMessage
from pydantic import BaseModel
from core.model_runtime.entities.message_entities import (
AssistantPromptMessage,
ImagePromptMessageContent,
PromptMessage,
SystemPro... | null |
16,848 | import enum
from typing import Any, cast
from langchain.schema import AIMessage, BaseMessage, FunctionMessage, HumanMessage, SystemMessage
from pydantic import BaseModel
from core.model_runtime.entities.message_entities import (
AssistantPromptMessage,
ImagePromptMessageContent,
PromptMessage,
SystemPro... | null |
16,849 | import base64
from extensions.ext_database import db
from libs import rsa
from models.account import Tenant
def obfuscated_token(token: str):
return token[:6] + '*' * (len(token) - 8) + token[-2:] | null |
16,850 | import base64
from extensions.ext_database import db
from libs import rsa
from models.account import Tenant
db = SQLAlchemy()
class Tenant(db.Model):
__tablename__ = 'tenants'
__table_args__ = (
db.PrimaryKeyConstraint('id', name='tenant_pkey'),
)
id = db.Column(UUID, server_default=db.text('... | null |
16,851 | import base64
from extensions.ext_database import db
from libs import rsa
from models.account import Tenant
def decrypt_token(tenant_id: str, token: str):
return rsa.decrypt(base64.b64decode(token), tenant_id) | null |
16,852 | import base64
from extensions.ext_database import db
from libs import rsa
from models.account import Tenant
def get_decrypt_decoding(tenant_id: str):
return rsa.get_decrypt_decoding(tenant_id)
def decrypt_token_with_decoding(token: str, rsa_key, cipher_rsa):
return rsa.decrypt_token_with_decoding(base64.b64deco... | null |
16,853 | import logging
import random
from core.entities.application_entities import ModelConfigEntity
from core.model_runtime.errors.invoke import InvokeBadRequestError
from core.model_runtime.model_providers.openai.moderation.moderation import OpenAIModerationModel
from extensions.ext_hosting_provider import hosting_configura... | null |
16,854 | import os
from httpx import get as _get
from httpx import head as _head
from httpx import options as _options
from httpx import patch as _patch
from httpx import post as _post
from httpx import put as _put
from requests import delete as _delete
httpx_proxies = {
'http://': SSRF_PROXY_HTTP_URL,
'https://': SSRF_... | null |
16,855 | import os
from httpx import get as _get
from httpx import head as _head
from httpx import options as _options
from httpx import patch as _patch
from httpx import post as _post
from httpx import put as _put
from requests import delete as _delete
httpx_proxies = {
'http://': SSRF_PROXY_HTTP_URL,
'https://': SSRF_... | null |
16,856 | import os
from httpx import get as _get
from httpx import head as _head
from httpx import options as _options
from httpx import patch as _patch
from httpx import post as _post
from httpx import put as _put
from requests import delete as _delete
httpx_proxies = {
'http://': SSRF_PROXY_HTTP_URL,
'https://': SSRF_... | null |
16,857 | import os
from httpx import get as _get
from httpx import head as _head
from httpx import options as _options
from httpx import patch as _patch
from httpx import post as _post
from httpx import put as _put
from requests import delete as _delete
httpx_proxies = {
'http://': SSRF_PROXY_HTTP_URL,
'https://': SSRF_... | null |
16,858 | import os
from httpx import get as _get
from httpx import head as _head
from httpx import options as _options
from httpx import patch as _patch
from httpx import post as _post
from httpx import put as _put
from requests import delete as _delete
requests_proxies = {
'http': SSRF_PROXY_HTTP_URL,
'https': SSRF_PRO... | null |
16,859 | import os
from httpx import get as _get
from httpx import head as _head
from httpx import options as _options
from httpx import patch as _patch
from httpx import post as _post
from httpx import put as _put
from requests import delete as _delete
httpx_proxies = {
'http://': SSRF_PROXY_HTTP_URL,
'https://': SSRF_... | null |
16,860 | import os
from httpx import get as _get
from httpx import head as _head
from httpx import options as _options
from httpx import patch as _patch
from httpx import post as _post
from httpx import put as _put
from requests import delete as _delete
httpx_proxies = {
'http://': SSRF_PROXY_HTTP_URL,
'https://': SSRF_... | null |
16,861 | import concurrent.futures
from typing import NamedTuple, Optional, cast
class FileEncoding(NamedTuple):
"""A file encoding as the NamedTuple."""
encoding: Optional[str]
"""The encoding of the file."""
confidence: float
"""The confidence of the encoding."""
language: Optional[str]
"""The lang... | Try to detect the file encoding. Returns a list of `FileEncoding` tuples with the detected encodings ordered by confidence. Args: file_path: The path to the file to detect the encoding for. timeout: The timeout in seconds for the encoding detection. |
16,862 | from __future__ import annotations
import copy
import logging
import re
from abc import ABC, abstractmethod
from collections.abc import Callable, Collection, Iterable, Sequence, Set
from dataclasses import dataclass
from enum import Enum
from typing import (
Any,
Literal,
Optional,
TypedDict,
TypeVa... | null |
16,863 | from __future__ import annotations
import copy
import logging
import re
from abc import ABC, abstractmethod
from collections.abc import Callable, Collection, Iterable, Sequence, Set
from dataclasses import dataclass
from enum import Enum
from typing import (
Any,
Literal,
Optional,
TypedDict,
TypeVa... | Split incoming text and return chunks using tokenizer. |
16,864 | import uuid
def is_valid_uuid(uuid_str: str) -> bool:
try:
uuid.UUID(uuid_str)
return True
except Exception:
return False | null |
16,865 | import hashlib
import json
import os
import re
import site
import subprocess
import tempfile
import unicodedata
from contextlib import contextmanager
import requests
from bs4 import BeautifulSoup, CData, Comment, NavigableString
from newspaper import Article
from regex import regex
from core.rag.extractor import extrac... | Page through `text` and return a substring of `max_length` characters starting from `cursor`. |
16,866 | import hashlib
import json
import os
import re
import site
import subprocess
import tempfile
import unicodedata
from contextlib import contextmanager
import requests
from bs4 import BeautifulSoup, CData, Comment, NavigableString
from newspaper import Article
from regex import regex
from core.rag.extractor import extrac... | Fetch URL and return the contents as a string. |
16,867 | from pydantic import BaseModel
The provided code snippet includes necessary dependencies for implementing the `serialize_base_model_array` function. Write a Python function `def serialize_base_model_array(l: list[BaseModel]) -> str` to solve the following problem:
{"__root__": [BaseModel, BaseModel, ...]}
Here is the... | {"__root__": [BaseModel, BaseModel, ...]} |
16,868 | from pydantic import BaseModel
The provided code snippet includes necessary dependencies for implementing the `serialize_base_model_dict` function. Write a Python function `def serialize_base_model_dict(b: dict) -> str` to solve the following problem:
{"__root__": {BaseModel}}
Here is the function:
def serialize_bas... | {"__root__": {BaseModel}} |
16,869 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('app_model_configs', schema=None) as batch_op:
batch_op.add_column(sa.Column('external_data_tools', sa.Text(), nullable=True))
# ### end Alembic com... | null |
16,870 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('app_model_configs', schema=None) as batch_op:
batch_op.drop_column('external_data_tools')
# ### end Alembic commands ### | null |
16,871 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tool_providers',
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
sa.C... | null |
16,872 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('app_model_configs', schema=None) as batch_op:
batch_op.drop_column('sensitive_word_avoidance')
op.drop... | null |
16,873 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('dataset_collection_bindings',
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=Fal... | null |
16,874 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('datasets', schema=None) as batch_op:
batch_op.drop_column('collection_binding_id')
with op.batch_alter... | null |
16,875 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('accounts', schema=None) as batch_op:
batch_op.add_column(sa.Column('last_active_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), null... | null |
16,876 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('accounts', schema=None) as batch_op:
batch_op.drop_column('last_active_at')
# ### end Alembic commands ### | null |
16,877 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('providers', schema=None) as batch_op:
batch_op.alter_column('quota_limit',
existing_type=sa.INTEGER(),
type_=sa.BigInteger... | null |
16,878 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('providers', schema=None) as batch_op:
batch_op.alter_column('quota_used',
existing_type=sa.BigInteger(),
type_=sa.INTEGE... | null |
16,879 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('provider_models', schema=None) as batch_op:
batch_op.alter_column('model_name',
existing_type=sa.VARCHAR(length=40),
... | null |
16,880 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('provider_models', schema=None) as batch_op:
batch_op.alter_column('model_name',
existing_type=sa.String(length=255),
... | null |
16,881 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('app_model_configs', schema=None) as batch_op:
batch_op.add_column(sa.Column('prompt_type', sa.String(length=255), nullable=False, server_default='simple... | null |
16,882 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('app_model_configs', schema=None) as batch_op:
batch_op.drop_column('dataset_configs')
batch_op.drop_column('completion_prompt_config')
... | null |
16,883 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('provider_models',
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
sa.... | null |
16,884 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tenant_preferred_model_providers', schema=None) as batch_op:
batch_op.drop_index('tenant_preferred_model_pr... | null |
16,885 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('sites', schema=None) as batch_op:
batch_op.alter_column('description',
existing_type=sa.VARCHAR(length=255),
type_=sa.Text... | null |
16,886 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('sites', schema=None) as batch_op:
batch_op.alter_column('description',
existing_type=sa.Text(),
type_=sa.VARCHAR(length=... | null |
16,887 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute('CREATE EXTENSION IF NOT EXISTS "uuid-ossp";')
op.create_table('account_integrates',
sa.Column('id', postgresql.UUID(), serv... | null |
16,888 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('messages', schema=None) as batch_op:
batch_op.drop_index('message_end_user_idx')
batch_op.drop_inde... | null |
16,889 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('data_source_bindings',
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
... | null |
16,890 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('data_source_bindings', schema=None) as batch_op:
batch_op.drop_index('source_info_idx', postgresql_using='g... | null |
16,891 | from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tool_api_providers', schema=None) as batch_op:
batch_op.create_unique_constraint('unique_api_tool_provider', ['name', 'tenant_id'])
with op.batch_alter_table('tool_files',... | null |
16,892 | from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tool_files', schema=None) as batch_op:
batch_op.drop_index('tool_file_conversation_id_idx')
with op.batch_alter_table('tool_api_providers', schema=None) as batch_op:
... | null |
16,893 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('datasets', schema=None) as batch_op:
batch_op.alter_column('embedding_model',
existing_type=sa.VARCHAR(length=255),
nullab... | null |
16,894 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('datasets', schema=None) as batch_op:
batch_op.alter_column('embedding_model_provider',
existing_type=sa.VARCHAR(length=255),
... | null |
16,895 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tool_conversation_variables',
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=Fal... | null |
16,896 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tool_api_providers', schema=None) as batch_op:
batch_op.alter_column('icon',
existing_type=s... | null |
16,897 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tool_api_providers', schema=None) as batch_op:
batch_op.add_column(sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)')... | null |
16,898 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tool_api_providers', schema=None) as batch_op:
batch_op.drop_column('updated_at')
batch_op.drop_column('created_at')
# ### end Alembic co... | null |
16,899 | import sqlalchemy as sa
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('embeddings', schema=None) as batch_op:
batch_op.add_column(sa.Column('model_name', sa.String(length=40), server_default=sa.text("'text-embedding-ada-002... | null |
16,900 | import sqlalchemy as sa
from alembic import op
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('embeddings', schema=None) as batch_op:
batch_op.drop_constraint('embedding_hash_idx', type_='unique')
batch_op.create_unique_constraint('embed... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.