id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
146,183
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_column('agent_executions', 'permission_id') op.drop_table('agent_execution_permissions') # ### end Alembic commands ###
null
146,184
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('first_login_source', sa.String(), nullable=True)) # ### end Alembic commands ###
null
146,185
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_column('users', 'first_login_source') # ### end Alembic commands ###
null
146,186
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('agent_schedule', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Inte...
null
146,187
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_agent_schedule_agent_id'), table_name='agent_schedule') op.drop_index(op.f('ix_agent_schedule_status'), table_name='agent_schedule') op.drop_index...
null
146,188
from alembic import op import sqlalchemy as sa def upgrade() -> None: op.rename_table('agent_workflows', 'iteration_workflows') op.rename_table('agent_workflow_steps', 'iteration_workflow_steps') with op.batch_alter_table('iteration_workflow_steps') as bop: bop.alter_column('agent_workflow_id', ne...
null
146,189
from alembic import op import sqlalchemy as sa def downgrade() -> None: op.rename_table('iteration_workflows', 'agent_workflows') op.rename_table('iteration_workflow_steps', 'agent_workflow_steps') op.drop_column('agent_executions', 'iteration_workflow_step_id') op.drop_column('agent_workflows', 'has_t...
null
146,190
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column('resources', sa.Column('agent_id', sa.Integer(), nullable=True)) op.drop_column('resources', 'project_id') # ### end Alembic commands ###
null
146,191
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column('resources', sa.Column('project_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.drop_column('resources', 'agent_id') # ### end Alembic commands ...
null
146,192
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('agent_workflow_step_waits', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(), nullable=True), sa.Column('description', sa....
null
146,193
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_table('agent_workflow_step_waits') # ### end Alembic commands ###
null
146,194
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('models', sa.Column('id', sa.Integer(), nullable=False), sa.Column('model_name', sa.String(), nullable=False), sa.Column('description', sa.String(), nu...
null
146,195
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_table('models') # ### end Alembic commands ###
null
146,196
from alembic import op import sqlalchemy as sa def upgrade() -> None: op.create_table('agent_templates', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=F...
null
146,197
from alembic import op import sqlalchemy as sa def downgrade() -> None: op.drop_table('agent_template_configs') op.drop_table('agent_templates')
null
146,198
from alembic import op import sqlalchemy as sa from sqlalchemy.engine.reflection import Inspector tables = inspector.get_table_names() def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### if 'agent_configurations' not in tables: op.create_table('agent_configurations', ...
null
146,199
from alembic import op import sqlalchemy as sa from sqlalchemy.engine.reflection import Inspector def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_table('users') op.drop_table('tools') op.drop_table('tool_configs') op.drop_table('projects') op.drop_...
null
146,200
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column('models', sa.Column('context_length', sa.Integer(), nullable=True)) # ### end Alembic commands ###
null
146,201
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_column('models', 'context_length') # ### end Alembic commands ###
null
146,202
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column('agent_execution_feeds', sa.Column('error_message', sa.String(), nullable=True)) op.add_column('agent_executions', sa.Column('last_shown_error_id', sa.Integer(),...
null
146,203
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_column('agent_executions', 'last_shown_error_id') op.drop_column('agent_execution_feeds', 'error_message') # ### end Alembic commands ###
null
146,204
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('oauth_tokens', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Intege...
null
146,205
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_index('ix_agt_agnt_workflow_id', 'agent_templates', ['agent_workflow_id'], unique=False) op.create_index('ix_agt_agnt_organisation_id', 'agent_templates', ['organi...
null
146,206
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column('resources', sa.Column('agent_execution_id', sa.Integer(), nullable=True)) # ### end Alembic commands ###
null
146,207
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_column('resources', 'agent_execution_id') # ### end Alembic commands ###
null
146,208
from alembic import op import sqlalchemy as sa def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('configurations', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Inte...
null
146,209
from alembic import op import sqlalchemy as sa def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_index('ix_agents_agnt_template_id', 'agents', ['agent_template_id'], unique=False) op.create_index('ix_at_name', 'agent_templates', ['name'], unique=False) op....
null
146,210
from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context from urllib.parse import urlparse config = context.config if config.config_file_name is not None: fileConfig(config.config_file_name) from superagi.models.base_model import DBBaseM...
Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output.
146,211
from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context from urllib.parse import urlparse config = context.config if config.config_file_name is not None: fileConfig(config.config_file_name) from superagi.models.base_model import DBBaseM...
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
146,212
import os import sys import subprocess from time import sleep import shutil from superagi.lib.logger import logger logger = Logger('Super AGI') def check_command(command, message): if not shutil.which(command): logger.info(message) sys.exit(1)
null
146,213
import os import sys import subprocess from time import sleep import shutil from superagi.lib.logger import logger logger = Logger('Super AGI') def run_npm_commands(): os.chdir("gui") try: subprocess.run(["npm", "install"], check=True) except subprocess.CalledProcessError: logger.error(f"E...
null
146,214
import os import sys import subprocess from time import sleep import shutil from superagi.lib.logger import logger def run_server(): api_process = subprocess.Popen(["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]) os.chdir("gui") ui_process = subprocess.Popen(["npm", "run", "dev"]) os.chd...
null
146,215
import os import sys import subprocess from time import sleep import shutil from superagi.lib.logger import logger logger = Logger('Super AGI') def cleanup(api_process, ui_process): logger.info("Shutting down processes...") api_process.terminate() ui_process.terminate() logger.info("Processes terminat...
null
146,216
import os import sys import subprocess from time import sleep import shutil from sys import platform from multiprocessing import Process from superagi.lib.logger import logger logger = Logger('Super AGI') def check_command(command, message): if not shutil.which(command): logger.info(message) sys.e...
null
146,217
import os import sys import subprocess from time import sleep import shutil from sys import platform from multiprocessing import Process from superagi.lib.logger import logger logger = Logger('Super AGI') def run_npm_commands(shell=False): os.chdir("gui") try: subprocess.run(["npm", "install"], check=...
null
146,218
import os import sys import subprocess from time import sleep import shutil from sys import platform from multiprocessing import Process from superagi.lib.logger import logger def run_server(shell=False,a_name=None,a_description=None,goals=None): tgwui_process = Process(target=subprocess.run, args=(["python", "tes...
null
146,219
import os import sys import subprocess from time import sleep import shutil from sys import platform from multiprocessing import Process from superagi.lib.logger import logger logger = Logger('Super AGI') def cleanup(api_process, ui_process, celery_process): logger.info("Shutting down processes...") api_proce...
null
146,220
from langchain.vectorstores import FAISS from langchain.document_loaders import UnstructuredFileLoader from langchain.text_splitter import CharacterTextSplitter from langchain_core.prompts import ChatPromptTemplate from langchain_core.output_parsers import StrOutputParser from langchain.chains import LLMChain from lang...
Create the context for the prompt from the subquestions and answers
146,221
import argparse import logging import os import sys from . import main from .errors import ModelServerException from .model import ModelTypes class ModelTypes(Enum): """A enumerator of the supported model types.""" LLAMA = auto() CODE_LLAMA = auto() GPTNEXT = auto() def family(self) -> str: ...
Parse the comamnd line arguments.
146,222
import argparse import logging import os import sys from . import main from .errors import ModelServerException from .model import ModelTypes _LOG_FMT = f"[{os.getpid()}] %(asctime)15s [%(levelname)7s] - %(name)s - %(message)s" _LOG_DATE_FMT = "%b %d %H:%M:%S" _LOGGER = logging.getLogger("main") The provided code snip...
Configure Python's logger according to the given verbosity level. :param verbosity: The desired verbosity level. Must be one of 0, 1, or 2. :type verbosity: typing.Literal[0, 1, 2]
146,223
import argparse import logging import os import sys from . import main from .errors import ModelServerException from .model import ModelTypes TERMINATION_LOG = "/dev/termination-log" _LOGGER = logging.getLogger("main") def _k8s_error_handler(err: Exception) -> None: """When running in Kubernetes, write errors to th...
Catch and handle exceptions from the applicaiton.
146,224
import glob import hashlib import logging import os import pathlib import subprocess import typing from enum import Enum, auto, unique from .errors import ModelServerException HASH_COMMAND = "sha1sum" The provided code snippet includes necessary dependencies for implementing the `_fast_hash_dir` function. Write a Pyth...
Read the files in a directory and quickly create a hash. This hash IS NOT cryptographically secure, but it is designed to be computed as quickly as reasonably possible. This function will only hash top level files and will not traverse directories.
146,225
import logging import os from glob import glob from tarfile import TarFile from typing import IO, cast import yaml from nemo.export import TensorRTLLM from ..errors import ModelServerException from ..model import Model from . import ConversionOptions _LOGGER = logging.getLogger(__name__) class ModelServerException(Ex...
Convert a .nemo formatted model.
146,226
import logging import os import subprocess import sys import typing from ..errors import ModelServerException, UnsupportedFormatException from ..model import Model from . import ConversionOptions _CONVERSION_SCRIPTS = "/opt/conversion_scripts/llama" _CHECKPOINT_ARGS_FLAGS = {"PYTORCH": "--meta_ckpt_dir", "HUGGINGFACE":...
Convert a llama model.
146,227
import argparse import json import os import time from pathlib import Path import tensorrt as trt import tensorrt_llm import torch import torch.multiprocessing as mp from tensorrt_llm._utils import str_dtype_to_trt from tensorrt_llm.builder import Builder from tensorrt_llm.layers.attention import PositionEmbeddingType ...
null
146,228
import argparse import json import os import time from pathlib import Path import tensorrt as trt import tensorrt_llm import torch import torch.multiprocessing as mp from tensorrt_llm._utils import str_dtype_to_trt from tensorrt_llm.builder import Builder from tensorrt_llm.layers.attention import PositionEmbeddingType ...
null
146,229
import functools import logging import os from typing import Any, Dict, List, Tuple, Union import riva.client import gradio as gr from frontend import assets, chat_client, asr_utils, tts_utils TITLE = "Converse" _LOCAL_CSS = """ #contextbox { overflow-y: scroll !important; max-height: 400px; } """ def _stream_p...
Build the gradio page to be mounted in the frame.
146,230
from pathlib import Path from typing import List import os import gradio as gr from frontend import assets, chat_client TITLE = "Knowledge Base Management" def upload_file(files: List[Path], client: chat_client.ChatClient) -> List[str]: """Use the client to upload a file to the knowledge base.""" try: f...
Buiild the gradio page to be mounted in the frame.
146,231
import os from opentelemetry import trace from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from opentelemetry...
null
146,232
import os from opentelemetry import trace from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from opentelemetry...
null
146,233
import queue from threading import Thread import logging import grpc import pycountry import gradio as gr import numpy as np import riva.client import riva.client.proto.riva_asr_pb2 as riva_asr import riva.client.proto.riva_asr_pb2_grpc as rasr_srv _LOGGER = logging.getLogger(__name__) ASR_LANGS = dict() grpc_auth = No...
null
146,234
import queue from threading import Thread import logging import grpc import pycountry import gradio as gr import numpy as np import riva.client import riva.client.proto.riva_asr_pb2 as riva_asr import riva.client.proto.riva_asr_pb2_grpc as rasr_srv _LOGGER = logging.getLogger(__name__) def start_recording(audio, langu...
null
146,235
import queue from threading import Thread import logging import grpc import pycountry import gradio as gr import numpy as np import riva.client import riva.client.proto.riva_asr_pb2 as riva_asr import riva.client.proto.riva_asr_pb2_grpc as rasr_srv _LOGGER = logging.getLogger(__name__) def stop_recording(asr_session):...
null
146,236
import queue from threading import Thread import logging import grpc import pycountry import gradio as gr import numpy as np import riva.client import riva.client.proto.riva_asr_pb2 as riva_asr import riva.client.proto.riva_asr_pb2_grpc as rasr_srv _LOGGER = logging.getLogger(__name__) ASR_LANGS = dict() grpc_auth = No...
null
146,237
import argparse import os import sys import uvicorn The provided code snippet includes necessary dependencies for implementing the `parse_args` function. Write a Python function `def parse_args() -> argparse.Namespace` to solve the following problem: Parse command-line arguments for the program. :returns: A namespace ...
Parse command-line arguments for the program. :returns: A namespace containing the parsed arguments. :rtype: argparse.Namespace
146,238
import json import logging import os from dataclasses import _MISSING_TYPE, dataclass from typing import Any, Callable, Dict, List, Optional, TextIO, Tuple, Union import yaml from dataclass_wizard import ( JSONWizard, LoadMeta, YAMLWizard, errors, fromdict, json_field, ) from dataclass_wizard.mo...
Create a data class field with the specified name in JSON format. :param name: The name of the field. :type name: str :param env: Whether this field should be configurable from an environment variable. :type env: bool :param help_txt: The description of this field that is used in help docs. :type help_txt: str :param *...
146,239
import json import logging import os from dataclasses import _MISSING_TYPE, dataclass from typing import Any, Callable, Dict, List, Optional, TextIO, Tuple, Union import yaml from dataclass_wizard import ( JSONWizard, LoadMeta, YAMLWizard, errors, fromdict, json_field, ) from dataclass_wizard.mo...
Read a file without knowing if it is JSON or YAML formatted. The file will first be assumed to be JSON formatted. If this fails, an attempt to parse the file with the YAML parser will be made. If both of these fail, an exception will be raised that contains the exception strings returned by both the parsers. :param str...
146,240
import json import logging import os from dataclasses import _MISSING_TYPE, dataclass from typing import Any, Callable, Dict, List, Optional, TextIO, Tuple, Union import yaml from dataclass_wizard import ( JSONWizard, LoadMeta, YAMLWizard, errors, fromdict, json_field, ) from dataclass_wizard.mo...
Try parsing the value as JSON and silently ignore errors. :param value: The value on which a JSON load should be attempted. :type value: str :returns: Either the parsed JSON or the provided value. :rtype: typing.Any
146,241
import json import logging import os from dataclasses import _MISSING_TYPE, dataclass from typing import Any, Callable, Dict, List, Optional, TextIO, Tuple, Union import yaml from dataclass_wizard import ( JSONWizard, LoadMeta, YAMLWizard, errors, fromdict, json_field, ) from dataclass_wizard.mo...
Update a dictionary with a new value at a given path. :param data: The dictionary to be updated. :type data: Dict[str, Any] :param path: The path to the key that should be updated. :type path: Tuple[str, ...] :param value: The new value to be set at the specified path. :type value: Any :param overwrite: If True, overwr...
146,242
import os import time import json import logging import pycountry from pathlib import Path from threading import Thread from typing import TYPE_CHECKING, Any, List import gradio as gr import numpy as np import riva.client import riva.client.proto.riva_tts_pb2 as riva_tts _LOGGER = logging.getLogger(__name__) TTS_MODELS...
null
146,243
import os import time import json import logging import pycountry from pathlib import Path from threading import Thread from typing import TYPE_CHECKING, Any, List import gradio as gr import numpy as np import riva.client import riva.client.proto.riva_tts_pb2 as riva_tts TTS_MODELS = dict() def update_voice_dropdown(l...
null
146,244
import os import time import json import logging import pycountry from pathlib import Path from threading import Thread from typing import TYPE_CHECKING, Any, List import gradio as gr import numpy as np import riva.client import riva.client.proto.riva_tts_pb2 as riva_tts _LOGGER = logging.getLogger(__name__) tts_sample...
null
146,245
import os import base64 import logging from functools import lru_cache from urllib.parse import urlparse from typing import TYPE_CHECKING, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.language_models.chat_models import SimpleChatModel from langchain.llms.base import LLM from integ...
Set the global service context.
146,246
import os import base64 import logging from functools import lru_cache from urllib.parse import urlparse from typing import TYPE_CHECKING, List, Optional logger = logging.getLogger(__name__) from langchain_core.embeddings import Embeddings from langchain_core.language_models.chat_models import SimpleChatModel from lang...
Create the vector db index for langchain.
146,247
import os import base64 import logging from functools import lru_cache from urllib.parse import urlparse from typing import TYPE_CHECKING, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.language_models.chat_models import SimpleChatModel from langchain.llms.base import LLM from integ...
Create the document retriever.
146,248
import os import base64 import logging from functools import lru_cache from urllib.parse import urlparse from typing import TYPE_CHECKING, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.language_models.chat_models import SimpleChatModel from langchain.llms.base import LLM from integ...
Check if a string is base64 encoded.
146,249
import os import base64 import logging from functools import lru_cache from urllib.parse import urlparse from typing import TYPE_CHECKING, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.language_models.chat_models import SimpleChatModel from langchain.llms.base import LLM from integ...
Return the token text splitter instance from langchain.
146,250
import os from opentelemetry import trace, context from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from open...
null
146,251
import base64 import os import shutil import logging from pathlib import Path from typing import Any, Dict, List import importlib from inspect import getmembers, isclass from fastapi import FastAPI, File, UploadFile, Request from fastapi.responses import JSONResponse, StreamingResponse from pydantic import BaseModel, F...
Import the example class from the specified example file. The example directory is expected to have a python file where the example class is defined.
146,252
import base64 import os import shutil import logging from pathlib import Path from typing import Any, Dict, List import importlib from inspect import getmembers, isclass from fastapi import FastAPI, File, UploadFile, Request from fastapi.responses import JSONResponse, StreamingResponse from pydantic import BaseModel, F...
Upload a document to the vector store.
146,253
import base64 import os import shutil import logging from pathlib import Path from typing import Any, Dict, List import importlib from inspect import getmembers, isclass from fastapi import FastAPI, File, UploadFile, Request from fastapi.responses import JSONResponse, StreamingResponse from pydantic import BaseModel, F...
Generate and stream the response to the provided prompt.
146,254
import base64 import os import shutil import logging from pathlib import Path from typing import Any, Dict, List import importlib from inspect import getmembers, isclass from fastapi import FastAPI, File, UploadFile, Request from fastapi.responses import JSONResponse, StreamingResponse from pydantic import BaseModel, F...
Search for the most relevant documents for the given search parameters.
146,259
import logging import mrc from pydantic import ValidationError from vdb_upload.module.schema_transform import SchemaTransformLoaderFactory from vdb_upload.schemas.rss_source_pipe_schema import RSSSourcePipeSchema from morpheus.modules.general.monitor import MonitorLoaderFactory from morpheus.modules.input.rss_source im...
Creates a pipeline for processing RSS feeds. This function sets up a pipeline that takes RSS feed data, scrapes web content based on the feed, and then outputs the scraped data. It integrates modules like RSS source, web scraper, and deserializer, along with monitoring for each stage. Parameters ---------- builder : mr...
146,260
import logging import os from functools import partial import mrc import mrc.core.operators as ops import pandas as pd from langchain.text_splitter import RecursiveCharacterTextSplitter from pydantic import ValidationError import cudf from morpheus.messages import MessageMeta from morpheus.utils.module_utils import Mod...
null
146,261
import logging import mrc from pydantic import ValidationError from morpheus.modules.general.monitor import MonitorLoaderFactory from morpheus.modules.preprocess.deserialize import DeserializeLoaderFactory from morpheus.modules.input.rss_source import RSSSourceLoaderFactory from morpheus.utils.module_utils import Modul...
Sets up a pipeline for processing kafka sources. This function configures a pipeline that subscribes to a kafka topic, processes received content based on specified configurations, and outputs the processed data. It integrates modules for kafka sourcing, content extraction, and schema transformation, along with monitor...
146,262
import logging from typing import Any from typing import Dict from typing import Optional import mrc import mrc.core.operators as ops from pydantic import BaseModel from pydantic import Field from pydantic import ValidationError import cudf from morpheus.messages import MessageMeta from morpheus.utils.column_info impor...
A module for applying simple DataFrame schema transform policies. This module reads the configuration to determine how to set data types for columns, select, or rename them in the dataframe. Parameters ---------- builder : mrc.Builder The Morpheus pipeline builder object. Notes ------------- The configuration should be...
146,263
import logging import mrc from pydantic import ValidationError from vdb_upload.module.schema_transform import SchemaTransformLoaderFactory from vdb_upload.schemas.file_source_pipe_schema import FileSourcePipeSchema from morpheus.modules.general.monitor import MonitorLoaderFactory from morpheus.modules.input.multi_file_...
Sets up a pipeline for processing file sources. This function configures a pipeline that reads files, processes their content based on specified configurations, and outputs the processed data. It integrates modules for multi-file sourcing, file content extraction, and schema transformation, along with monitoring at var...
146,264
import logging import mrc from pydantic import BaseModel from pydantic import ValidationError from morpheus.messages import ControlMessage from morpheus.utils.module_utils import ModuleLoaderFactory from morpheus.utils.module_utils import register_module logger = logging.getLogger(__name__) class VDBResourceTaggingSche...
null
146,265
import logging from functools import partial import time import os import typing from enum import Enum from io import StringIO import confluent_kafka as ck import mrc import pandas as pd from pydantic import ValidationError import cudf from morpheus.messages import MessageMeta from morpheus.utils.module_utils import Mo...
null
146,266
import logging import os from functools import partial import mrc import mrc.core.operators as ops import requests import requests_cache from bs4 import BeautifulSoup import lxml from langchain.text_splitter import RecursiveCharacterTextSplitter from pydantic import BaseModel from pydantic import ValidationError impor...
null
146,267
import io import logging import os import typing from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass from functools import wraps from typing import Dict from typing import List import fitz import fsspec import mrc import mrc.core.operators as ops import pandas as pd from docx import Docu...
null
146,268
import io import logging import os import typing from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass from functools import wraps from typing import Dict from typing import List import fitz import fsspec import mrc import mrc.core.operators as ops import pandas as pd from docx import Docu...
Extracts text from PDF and TXT files and constructs a DataFrame with the extracted content. This module processes a batch of files, reading their contents and extracting text data to form a DataFrame. It can handle both PDF and TXT files. The module uses a ThreadPoolExecutor for parallel file reading. Parameters ------...
146,269
import logging import os import click from vdb_upload.vdb_utils import build_cli_configs from vdb_upload.vdb_utils import build_final_config from vdb_upload.vdb_utils import is_valid_service def run(): pass
null
146,270
import logging import os import click from vdb_upload.vdb_utils import build_cli_configs from vdb_upload.vdb_utils import build_final_config from vdb_upload.vdb_utils import is_valid_service def build_cli_configs(source_type, enable_cache, embedding_size, ...
Configure and run the data processing pipeline based on the specified command-line options. This function initializes and runs the data processing pipeline using configurations provided via command-line options. It supports customization for various components of the pipeline such as source type, embedding model, and v...
146,271
import logging import os import click from vdb_upload.vdb_utils import build_cli_configs from vdb_upload.vdb_utils import build_final_config from vdb_upload.vdb_utils import is_valid_service def chain(model_name, save_cache): with log_time(msg="Seeding with chain took {duration} ms. {rate_per_sec} docs/sec", log_f...
null
146,272
import logging import os import click from vdb_upload.vdb_utils import build_cli_configs from vdb_upload.vdb_utils import build_final_config from vdb_upload.vdb_utils import is_valid_service def build_triton_model(model_name, model_seq_length, max_batch_size, triton_repo, output_model_name): if (output_model_name...
null
146,273
import logging import time import typing from morpheus.config import Config from morpheus.pipeline.pipeline import Pipeline from morpheus.stages.general.monitor_stage import MonitorStage from morpheus.stages.general.trigger_stage import TriggerStage from morpheus.stages.inference.triton_inference_stage import TritonInf...
Sets up and runs a data processing pipeline based on provided configurations. Parameters ---------- source_config : Dict Configuration for data sources (e.g., 'rss', 'filesystem'). vdb_config : Dict Configuration for the vector database. pipeline_config : Dict General configuration for the pipeline (e.g., number of thr...
146,274
import logging import typing import pymilvus import yaml from morpheus.config import Config from morpheus.config import PipelineModes from morpheus.service.vdb.milvus_client import DATA_TYPE_MAP The provided code snippet includes necessary dependencies for implementing the `is_valid_service` function. Write a Python f...
Validate the provided vector database service name. Checks if the given vector database service name is supported and valid. This is used as a callback function for a CLI option to ensure that the user inputs a supported service name. Parameters ---------- ctx : click.Context The context within which the command is bei...
146,275
import time import json import argparse import os from abc import ABC, abstractmethod import jsonlines from confluent_kafka.admin import AdminClient from confluent_kafka.admin import NewTopic from confluent_kafka import Producer def load_jsonl(fpath): jsonl_list = [] with jsonlines.open(fpath) as f: fo...
null
146,276
import zipfile import io import argparse import json from pathlib import Path import jsonlines import fitz The provided code snippet includes necessary dependencies for implementing the `extract_archive` function. Write a Python function `def extract_archive(archive_path, extract_path="pdf_dataset")` to solve the foll...
Extract zip archive. Parameters ---------- archive_path: pathlib.Path Path to archive. extract_path: pathlib.Path Path to extract archive.
146,277
import zipfile import io import argparse import json from pathlib import Path import jsonlines import fitz The provided code snippet includes necessary dependencies for implementing the `extract_text` function. Write a Python function `def extract_text(pdf_stream)` to solve the following problem: Use PyMuPDF to extrac...
Use PyMuPDF to extract text from a bytestream PDF. Parameters ---------- pdf_stream : io.BytesIO A bytestream PDF. Returns ------- str A string of extracted text.
146,278
import os import streamlit as st from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.document_loaders import UnstructuredFileLoader from vectorstore.custom_powerpoint_parser import process_ppt_file from vectorstore.custom_pdf_parser import get_pdf_documents def load_documents(fol...
Generates word embeddings for documents and updates the Milvus collection.
146,279
import requests import json from langchain_nvidia_ai_endpoints import ChatNVIDIA import torch from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline from langchain_community.llms import HuggingFacePipeline class NvidiaLLM: def __init__(self, model_name): class LocalLLM: def __init__(self, mode...
null
146,280
import random import os import base64 import datetime import argparse import pandas as pd from PIL import Image from io import BytesIO import streamlit as st import streamlit_analytics from streamlit_feedback import streamlit_feedback from bot_config.utils import get_config from utils.memory import init_memory, get_sum...
null
146,281
from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_nvidia_ai_endpoints import ChatNVIDIA llm = ChatNVIDIA(model="mixtral_8x7b") def fact_check(evidence, query, response): system_message = f"""Your task is to conduct a thorough fact-check ...
null
146,282
import streamlit as st import os def check_env_var(): if "NVIDIA_API_KEY" not in os.environ: st.error("Please export your NVIDIA_API_KEY from the NVIDIA AI Playground to continue with LLMs/Embedding Models!", icon="🚨") st.stop()
null
146,283
import gspread import datetime import streamlit as st def add_row_to_sheet(values): scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] gc = gspread.service_account(filename="service.json") sh = gc.open_by_url("https://docs.google.com/spreadsheets/d/1R8sDCJ2jBSvEKh4awA...
null
146,284
from langchain.chains.conversation.memory import ConversationSummaryMemory from langchain_core.prompts.prompt import PromptTemplate def init_memory(llm, prompt_str): SUMMARY_PROMPT = PromptTemplate( input_variables=["summary", "new_lines"], template=prompt_str ) memory = ConversationSummaryMemo...
null
146,285
from langchain.chains.conversation.memory import ConversationSummaryMemory from langchain_core.prompts.prompt import PromptTemplate def get_summary(memory): return memory.buffer
null
146,286
from langchain.chains.conversation.memory import ConversationSummaryMemory from langchain_core.prompts.prompt import PromptTemplate def add_history_to_memory(memory, input_str, output_str): # add message to memory chat_memory = memory.chat_memory chat_memory.add_user_message(input_str) chat_memory.add...
null