Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mindsdb/interfaces/agents/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
USER_COLUMN = "question"
DEFAULT_EMBEDDINGS_MODEL_PROVIDER = "openai"
DEFAULT_EMBEDDINGS_MODEL_CLASS = OpenAIEmbeddings
MAX_INSERT_BATCH_SIZE = 50_000
MAX_INSERT_BATCH_SIZE = int(os.getenv("KB_MAX_INSERT_BATCH_SIZE", 50_000))
DEFAULT_TIKTOKEN_MODEL_NAME = os.getenv("DEFAULT_TIKTOKEN_MODEL_NAME", "gpt-4")
AGENT_CHUNK_POLLING_INTERVAL_SECONDS = os.getenv("AGENT_CHUNK_POLLING_INTERVAL_SECONDS", 1.0)
DEFAULT_TEXT2SQL_DATABASE = "mindsdb"
Expand Down
5 changes: 3 additions & 2 deletions mindsdb/interfaces/knowledge_base/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,6 @@ def insert_rows(self, rows: List[Dict]):
"""Process and insert raw data rows"""
if not rows:
return
if len(rows) > MAX_INSERT_BATCH_SIZE:
raise ValueError("Input data is too large, please load data in batches")

df = pd.DataFrame(rows)

Expand Down Expand Up @@ -700,6 +698,9 @@ def insert(self, df: pd.DataFrame, params: dict = None):
if df.empty:
return

if len(df) > MAX_INSERT_BATCH_SIZE:
raise ValueError("Input data is too large, please load data in batches")

try:
run_query_id = ctx.run_query_id
# Link current KB to running query (where KB is used to insert data)
Expand Down
Loading