ref: Fix ruff rules in preview mode (#4039)

Fix some ruff rules from preview mode
This commit is contained in:
Christophe Bornet 2024-10-08 21:31:13 +02:00 • committed by GitHub
commit da6b5eadbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
85 changed files with 259 additions and 7505 deletions

View file

@ -68,7 +68,7 @@ def set_var_for_macos_issue():
# we need to set this var is we are running on MacOS
# otherwise we get an error when running gunicorn
if platform.system() in ["Darwin"]:
if platform.system() == "Darwin":
import os
os.environ["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES"
@ -202,7 +202,7 @@ def run(
return
process: Process | None = None
try:
if platform.system() in ["Windows"]:
if platform.system() == "Windows":
# Run using uvicorn on MacOS and Windows
# Windows doesn't support gunicorn
# MacOS requires an env variable to be set to use gunicorn
@ -369,7 +369,7 @@ def run_langflow(host, port, log_level, options, app):
Run Langflow server on localhost
"""
if platform.system() in ["Windows"]:
if platform.system() == "Windows":
# Run using uvicorn on MacOS and Windows
# Windows doesn't support gunicorn
# MacOS requires an env variable to be set to use gunicorn
@ -538,7 +538,7 @@ def api_key_banner(unmasked_api_key):
f"[bold blue]{unmasked_api_key.api_key}[/bold blue]\n\n"
"This is the only time the API key will be displayed. \n"
"Make sure to store it in a secure location. \n\n"
f"The API key has been copied to your clipboard. [bold]{['Ctrl','Cmd'][is_mac]} + V[/bold] to paste it.",
f"The API key has been copied to your clipboard. [bold]{['Ctrl', 'Cmd'][is_mac]} + V[/bold] to paste it.",
box=box.ROUNDED,
border_style="blue",
expand=False,

View file

@ -2,4 +2,4 @@ from langflow.api.health_check_router import health_check_router
from langflow.api.log_router import log_router
from langflow.api.router import router
__all__ = ["router", "health_check_router", "log_router"]
__all__ = ["health_check_router", "log_router", "router"]

View file

@ -1,4 +1,5 @@
import uuid
from typing import Annotated
from fastapi import APIRouter, Depends, HTTPException, status
from loguru import logger
@ -37,7 +38,7 @@ async def health():
# It's a reliable health check for a langflow instance
@health_check_router.get("/health_check", response_model=HealthResponse)
async def health_check(
session: Session = Depends(get_session),
session: Annotated[Session, Depends(get_session)],
):
response = HealthResponse()
# use a fixed valid UUId that UUID collision is very unlikely

View file

@ -1,7 +1,7 @@
import asyncio
import json
from http import HTTPStatus
from typing import Any
from typing import Annotated, Any
from fastapi import APIRouter, HTTPException, Query, Request
from fastapi.responses import JSONResponse, StreamingResponse
@ -41,7 +41,7 @@ async def event_generator(request: Request):
last_read_item = item
if to_write:
for ts, msg in to_write:
yield f"{json.dumps({ts:msg})}\n\n"
yield f"{json.dumps({ts: msg})}\n\n"
else:
current_not_sent += 1
if current_not_sent == NUMBER_OF_NOT_SENT_BEFORE_KEEPALIVE:
@ -72,9 +72,9 @@ async def stream_logs(
@log_router.get("/logs")
async def logs(
lines_before: int = Query(0, description="The number of logs before the timestamp or the last log"),
lines_after: int = Query(0, description="The number of logs after the timestamp"),
timestamp: int = Query(0, description="The timestamp to start getting logs from"),
lines_before: Annotated[int, Query(description="The number of logs before the timestamp or the last log")] = 0,
lines_after: Annotated[int, Query(description="The number of logs after the timestamp")] = 0,
timestamp: Annotated[int, Query(description="The timestamp to start getting logs from")] = 0,
):
global log_buffer # noqa: PLW0602
if log_buffer.enabled() is False:

View file

@ -45,7 +45,7 @@ def build_input_keys_response(langchain_object, artifacts):
"""Build the input keys response."""
input_keys_response = {
"input_keys": {key: "" for key in langchain_object.input_keys},
"input_keys": dict.fromkeys(langchain_object.input_keys, ""),
"memory_keys": [],
"handle_keys": artifacts.get("handle_keys", []),
}

View file

@ -13,17 +13,17 @@ from langflow.api.v1.validate import router as validate_router
from langflow.api.v1.variable import router as variables_router
__all__ = [
"api_key_router",
"chat_router",
"endpoints_router",
"store_router",
"validate_router",
"flows_router",
"users_router",
"api_key_router",
"login_router",
"variables_router",
"monitor_router",
"files_router",
"flows_router",
"folders_router",
"login_router",
"monitor_router",
"starter_projects_router",
"store_router",
"users_router",
"validate_router",
"variables_router",
]

View file

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Annotated
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, Response
@ -21,8 +21,8 @@ router = APIRouter(tags=["APIKey"], prefix="/api_key")
@router.get("/", response_model=ApiKeysResponse)
def get_api_keys_route(
db: Session = Depends(get_session),
current_user: User = Depends(auth_utils.get_current_active_user),
db: Annotated[Session, Depends(get_session)],
current_user: Annotated[User, Depends(auth_utils.get_current_active_user)],
):
try:
user_id = current_user.id
@ -36,8 +36,8 @@ def get_api_keys_route(
@router.post("/", response_model=UnmaskedApiKeyRead)
def create_api_key_route(
req: ApiKeyCreate,
current_user: User = Depends(auth_utils.get_current_active_user),
db: Session = Depends(get_session),
current_user: Annotated[User, Depends(auth_utils.get_current_active_user)],
db: Annotated[Session, Depends(get_session)],
):
try:
user_id = current_user.id
@ -63,8 +63,8 @@ def delete_api_key_route(
def save_store_api_key(
api_key_request: ApiKeyCreateRequest,
response: Response,
current_user: User = Depends(auth_utils.get_current_active_user),
db: Session = Depends(get_session),
current_user: Annotated[User, Depends(auth_utils.get_current_active_user)],
db: Annotated[Session, Depends(get_session)],
settings_service=Depends(get_settings_service),
):
auth_settings = settings_service.auth_settings
@ -95,8 +95,8 @@ def save_store_api_key(
@router.delete("/store")
def delete_store_api_key(
current_user: User = Depends(auth_utils.get_current_active_user),
db: Session = Depends(get_session),
current_user: Annotated[User, Depends(auth_utils.get_current_active_user)],
db: Annotated[Session, Depends(get_session)],
):
try:
current_user.store_api_key = None

View file

@ -172,7 +172,7 @@ async def simple_run_flow_task(
logger.exception(f"Error running flow {flow.id} task")
@router.post("/run/{flow_id_or_name}", response_model=RunResponse, response_model_exclude_none=True)
@router.post("/run/{flow_id_or_name}", response_model=RunResponse, response_model_exclude_none=True) # noqa: RUF100, FAST003
async def simplified_run_flow(
background_tasks: BackgroundTasks,
flow: Annotated[FlowRead | None, Depends(get_flow_by_id_or_endpoint_name)],
@ -296,13 +296,13 @@ async def simplified_run_flow(
raise APIException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, exception=exc, flow=flow) from exc
@router.post("/webhook/{flow_id_or_name}", response_model=dict, status_code=HTTPStatus.ACCEPTED)
@router.post("/webhook/{flow_id_or_name}", response_model=dict, status_code=HTTPStatus.ACCEPTED) # noqa: RUF100, FAST003
async def webhook_run_flow(
flow: Annotated[Flow, Depends(get_flow_by_id_or_endpoint_name)],
user: Annotated[User, Depends(get_user_by_flow_id_or_endpoint_name)],
request: Request,
background_tasks: BackgroundTasks,
telemetry_service: TelemetryService = Depends(get_telemetry_service),
telemetry_service: Annotated[TelemetryService, Depends(get_telemetry_service)],
):
"""
Run a flow using a webhook request.
@ -441,10 +441,9 @@ async def experimental_run_flow(
if inputs is None:
inputs = [InputValueRequest(components=[], input_value="")]
artifacts = {}
if session_id:
session_data = await session_service.load_session(session_id, flow_id=flow_id_str)
graph, artifacts = session_data if session_data else (None, None)
graph, _artifacts = session_data or (None, None)
if graph is None:
msg = f"Session {session_id} not found"
raise ValueError(msg)
@ -585,7 +584,7 @@ def get_version():
@router.post("/custom_component", status_code=HTTPStatus.OK, response_model=CustomComponentResponse)
async def custom_component(
raw_code: CustomComponentRequest,
user: User = Depends(get_current_active_user),
user: Annotated[User, Depends(get_current_active_user)],
):
component = Component(_code=raw_code.code)
@ -600,7 +599,7 @@ async def custom_component(
@router.post("/custom_component/update", status_code=HTTPStatus.OK)
async def custom_component_update(
code_request: UpdateCustomComponentRequest,
user: User = Depends(get_current_active_user),
user: Annotated[User, Depends(get_current_active_user)],
):
"""
Update a custom component with the provided code request.

View file

@ -3,6 +3,7 @@ from datetime import datetime, timezone
from http import HTTPStatus
from io import BytesIO
from pathlib import Path
from typing import Annotated
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, UploadFile
@ -39,7 +40,7 @@ def get_flow_id(
@router.post("/upload/{flow_id}", status_code=HTTPStatus.CREATED)
async def upload_file(
file: UploadFile,
flow_id: UUID = Depends(get_flow_id),
flow_id: Annotated[UUID, Depends(get_flow_id)],
current_user=Depends(get_current_active_user),
session=Depends(get_session),
storage_service: StorageService = Depends(get_storage_service),
@ -68,7 +69,9 @@ async def upload_file(
@router.get("/download/{flow_id}/{file_name}")
async def download_file(file_name: str, flow_id: UUID, storage_service: StorageService = Depends(get_storage_service)):
async def download_file(
file_name: str, flow_id: UUID, storage_service: Annotated[StorageService, Depends(get_storage_service)]
):
try:
flow_id_str = str(flow_id)
extension = file_name.split(".")[-1]
@ -93,7 +96,9 @@ async def download_file(file_name: str, flow_id: UUID, storage_service: StorageS
@router.get("/images/{flow_id}/{file_name}")
async def download_image(file_name: str, flow_id: UUID, storage_service: StorageService = Depends(get_storage_service)):
async def download_image(
file_name: str, flow_id: UUID, storage_service: Annotated[StorageService, Depends(get_storage_service)]
):
try:
extension = file_name.split(".")[-1]
flow_id_str = str(flow_id)
@ -118,7 +123,7 @@ async def download_image(file_name: str, flow_id: UUID, storage_service: Storage
async def download_profile_picture(
folder_name: str,
file_name: str,
storage_service: StorageService = Depends(get_storage_service),
storage_service: Annotated[StorageService, Depends(get_storage_service)],
):
try:
extension = file_name.split(".")[-1]
@ -134,7 +139,7 @@ async def download_profile_picture(
@router.get("/profile_pictures/list")
async def list_profile_pictures(storage_service: StorageService = Depends(get_storage_service)):
async def list_profile_pictures(storage_service: Annotated[StorageService, Depends(get_storage_service)]):
try:
config_dir = get_storage_service().settings_service.settings.config_dir
config_path = Path(config_dir) # type: ignore
@ -156,7 +161,8 @@ async def list_profile_pictures(storage_service: StorageService = Depends(get_st
@router.get("/list/{flow_id}")
async def list_files(
flow_id: UUID = Depends(get_flow_id), storage_service: StorageService = Depends(get_storage_service)
flow_id: Annotated[UUID, Depends(get_flow_id)],
storage_service: Annotated[StorageService, Depends(get_storage_service)],
):
try:
flow_id_str = str(flow_id)
@ -168,7 +174,9 @@ async def list_files(
@router.delete("/delete/{flow_id}/{file_name}")
async def delete_file(
file_name: str, flow_id: UUID = Depends(get_flow_id), storage_service: StorageService = Depends(get_storage_service)
file_name: str,
flow_id: Annotated[UUID, Depends(get_flow_id)],
storage_service: Annotated[StorageService, Depends(get_storage_service)],
):
try:
flow_id_str = str(flow_id)

View file

@ -5,6 +5,7 @@ import json
import re
import zipfile
from datetime import datetime, timezone
from typing import Annotated
from uuid import UUID
import orjson
@ -326,7 +327,9 @@ async def upload_file(
@router.delete("/")
async def delete_multiple_flows(
flow_ids: list[UUID], user: User = Depends(get_current_active_user), db: Session = Depends(get_session)
flow_ids: list[UUID],
user: Annotated[User, Depends(get_current_active_user)],
db: Annotated[Session, Depends(get_session)],
):
"""
Delete multiple flows by their IDs.
@ -362,8 +365,8 @@ async def delete_multiple_flows(
@router.post("/download/", status_code=200)
async def download_multiple_file(
flow_ids: list[UUID],
user: User = Depends(get_current_active_user),
db: Session = Depends(get_session),
user: Annotated[User, Depends(get_current_active_user)],
db: Annotated[Session, Depends(get_session)],
):
"""Download all flows as a zip file."""
flows = db.exec(select(Flow).where(and_(Flow.user_id == user.id, Flow.id.in_(flow_ids)))).all() # type: ignore

View file

@ -1,5 +1,7 @@
from __future__ import annotations
from typing import Annotated
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status
from fastapi.security import OAuth2PasswordRequestForm
from sqlmodel import Session
@ -23,8 +25,8 @@ router = APIRouter(tags=["Login"])
@router.post("/login", response_model=Token)
async def login_to_get_access_token(
response: Response,
form_data: OAuth2PasswordRequestForm = Depends(),
db: Session = Depends(get_session),
form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
db: Annotated[Session, Depends(get_session)],
# _: Session = Depends(get_current_active_user)
settings_service=Depends(get_settings_service),
variable_service: VariableService = Depends(get_variable_service),
@ -82,7 +84,7 @@ async def login_to_get_access_token(
@router.get("/auto_login")
async def auto_login(
response: Response, db: Session = Depends(get_session), settings_service=Depends(get_settings_service)
response: Response, db: Annotated[Session, Depends(get_session)], settings_service=Depends(get_settings_service)
):
auth_settings = settings_service.auth_settings
@ -129,8 +131,8 @@ async def auto_login(
async def refresh_token(
request: Request,
response: Response,
settings_service: SettingsService = Depends(get_settings_service),
db: Session = Depends(get_session),
settings_service: Annotated[SettingsService, Depends(get_settings_service)],
db: Annotated[Session, Depends(get_session)],
):
auth_settings = settings_service.auth_settings

View file

@ -1,3 +1,4 @@
from typing import Annotated
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, Query
@ -22,8 +23,8 @@ router = APIRouter(prefix="/monitor", tags=["Monitor"])
@router.get("/builds", response_model=VertexBuildMapModel)
async def get_vertex_builds(
flow_id: UUID = Query(),
session: Session = Depends(get_session),
flow_id: Annotated[UUID, Query()],
session: Annotated[Session, Depends(get_session)],
):
try:
vertex_builds = get_vertex_builds_by_flow_id(session, flow_id)
@ -34,8 +35,8 @@ async def get_vertex_builds(
@router.delete("/builds", status_code=204)
async def delete_vertex_builds(
flow_id: UUID = Query(),
session: Session = Depends(get_session),
flow_id: Annotated[UUID, Query()],
session: Annotated[Session, Depends(get_session)],
):
try:
delete_vertex_builds_by_flow_id(session, flow_id)
@ -45,12 +46,12 @@ async def delete_vertex_builds(
@router.get("/messages", response_model=list[MessageResponse])
async def get_messages(
flow_id: str | None = Query(None),
session_id: str | None = Query(None),
sender: str | None = Query(None),
sender_name: str | None = Query(None),
order_by: str | None = Query("timestamp"),
session: Session = Depends(get_session),
session: Annotated[Session, Depends(get_session)],
flow_id: Annotated[str | None, Query()] = None,
session_id: Annotated[str | None, Query()] = None,
sender: Annotated[str | None, Query()] = None,
sender_name: Annotated[str | None, Query()] = None,
order_by: Annotated[str | None, Query()] = "timestamp",
):
try:
stmt = select(MessageTable)
@ -74,8 +75,8 @@ async def get_messages(
@router.delete("/messages", status_code=204)
async def delete_messages(
message_ids: list[UUID],
session: Session = Depends(get_session),
current_user: User = Depends(get_current_active_user),
session: Annotated[Session, Depends(get_session)],
current_user: Annotated[User, Depends(get_current_active_user)],
):
try:
session.exec(delete(MessageTable).where(MessageTable.id.in_(message_ids))) # type: ignore
@ -88,8 +89,8 @@ async def delete_messages(
async def update_message(
message_id: UUID,
message: MessageUpdate,
session: Session = Depends(get_session),
user: User = Depends(get_current_active_user),
session: Annotated[Session, Depends(get_session)],
user: Annotated[User, Depends(get_current_active_user)],
):
try:
db_message = session.get(MessageTable, message_id)
@ -110,9 +111,9 @@ async def update_message(
@router.patch("/messages/session/{old_session_id}", response_model=list[MessageResponse])
async def update_session_id(
old_session_id: str,
new_session_id: str = Query(..., description="The new session ID to update to"),
session: Session = Depends(get_session),
current_user: User = Depends(get_current_active_user),
new_session_id: Annotated[str, Query(..., description="The new session ID to update to")],
session: Annotated[Session, Depends(get_session)],
current_user: Annotated[User, Depends(get_current_active_user)],
):
try:
# Get all messages with the old session ID
@ -143,7 +144,7 @@ async def update_session_id(
@router.delete("/messages/session/{session_id}", status_code=204)
async def delete_messages_session(
session_id: str,
session: Session = Depends(get_session),
session: Annotated[Session, Depends(get_session)],
):
try:
session.exec( # type: ignore
@ -159,8 +160,8 @@ async def delete_messages_session(
@router.get("/transactions", response_model=list[TransactionReadResponse])
async def get_transactions(
flow_id: UUID = Query(),
session: Session = Depends(get_session),
flow_id: Annotated[UUID, Query()],
session: Annotated[Session, Depends(get_session)],
):
try:
transactions = get_transactions_by_flow_id(session, flow_id)

View file

@ -58,8 +58,8 @@ def check_if_store_is_enabled(
@router.get("/check/api_key")
async def check_if_store_has_api_key(
api_key: str | None = Depends(get_optional_user_store_api_key),
store_service: StoreService = Depends(get_store_service),
api_key: Annotated[str | None, Depends(get_optional_user_store_api_key)],
store_service: Annotated[StoreService, Depends(get_store_service)],
):
if api_key is None:
return {"has_api_key": False, "is_valid": False}
@ -75,8 +75,8 @@ async def check_if_store_has_api_key(
@router.post("/components/", response_model=CreateComponentResponse, status_code=201)
async def share_component(
component: StoreComponentCreate,
store_service: StoreService = Depends(get_store_service),
store_api_key: str = Depends(get_user_store_api_key),
store_service: Annotated[StoreService, Depends(get_store_service)],
store_api_key: Annotated[str, Depends(get_user_store_api_key)],
):
try:
await check_langflow_version(component)
@ -89,8 +89,8 @@ async def share_component(
async def update_shared_component(
component_id: UUID,
component: StoreComponentCreate,
store_service: StoreService = Depends(get_store_service),
store_api_key: str = Depends(get_user_store_api_key),
store_service: Annotated[StoreService, Depends(get_store_service)],
store_api_key: Annotated[str, Depends(get_user_store_api_key)],
):
try:
await check_langflow_version(component)
@ -139,8 +139,8 @@ async def get_components(
@router.get("/components/{component_id}", response_model=DownloadComponentResponse)
async def download_component(
component_id: UUID,
store_service: StoreService = Depends(get_store_service),
store_api_key: str = Depends(get_user_store_api_key),
store_service: Annotated[StoreService, Depends(get_store_service)],
store_api_key: Annotated[str, Depends(get_user_store_api_key)],
):
try:
component = await store_service.download(store_api_key, component_id)
@ -157,7 +157,7 @@ async def download_component(
@router.get("/tags", response_model=list[TagResponse])
async def get_tags(
store_service: StoreService = Depends(get_store_service),
store_service: Annotated[StoreService, Depends(get_store_service)],
):
try:
return await store_service.get_tags()
@ -169,8 +169,8 @@ async def get_tags(
@router.get("/users/likes", response_model=list[UsersLikesResponse])
async def get_list_of_components_liked_by_user(
store_service: StoreService = Depends(get_store_service),
store_api_key: str = Depends(get_user_store_api_key),
store_service: Annotated[StoreService, Depends(get_store_service)],
store_api_key: Annotated[str, Depends(get_user_store_api_key)],
):
try:
return await store_service.get_user_likes(store_api_key)
@ -183,8 +183,8 @@ async def get_list_of_components_liked_by_user(
@router.post("/users/likes/{component_id}", response_model=UsersLikesResponse)
async def like_component(
component_id: UUID,
store_service: StoreService = Depends(get_store_service),
store_api_key: str = Depends(get_user_store_api_key),
store_service: Annotated[StoreService, Depends(get_store_service)],
store_api_key: Annotated[str, Depends(get_user_store_api_key)],
):
try:
result = await store_service.like_component(store_api_key, str(component_id))

View file

@ -1,3 +1,4 @@
from typing import Annotated
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException
@ -24,7 +25,7 @@ router = APIRouter(tags=["Users"], prefix="/users")
@router.post("/", response_model=UserRead, status_code=201)
def add_user(
user: UserCreate,
session: Session = Depends(get_session),
session: Annotated[Session, Depends(get_session)],
settings_service=Depends(get_settings_service),
) -> User:
"""
@ -49,7 +50,7 @@ def add_user(
@router.get("/whoami", response_model=UserRead)
def read_current_user(
current_user: User = Depends(get_current_active_user),
current_user: Annotated[User, Depends(get_current_active_user)],
) -> User:
"""
Retrieve the current user's data.
@ -57,7 +58,7 @@ def read_current_user(
return current_user
@router.get("/", response_model=UsersResponse)
@router.get("/")
def read_all_users(
skip: int = 0,
limit: int = 10,
@ -83,8 +84,8 @@ def read_all_users(
def patch_user(
user_id: UUID,
user_update: UserUpdate,
user: User = Depends(get_current_active_user),
session: Session = Depends(get_session),
user: Annotated[User, Depends(get_current_active_user)],
session: Annotated[Session, Depends(get_session)],
) -> User:
"""
Update an existing user's data.
@ -113,8 +114,8 @@ def patch_user(
def reset_password(
user_id: UUID,
user_update: UserUpdate,
user: User = Depends(get_current_active_user),
session: Session = Depends(get_session),
user: Annotated[User, Depends(get_current_active_user)],
session: Annotated[Session, Depends(get_session)],
) -> User:
"""
Reset a user's password.
@ -134,11 +135,11 @@ def reset_password(
return user
@router.delete("/{user_id}", response_model=dict)
@router.delete("/{user_id}")
def delete_user(
user_id: UUID,
current_user: User = Depends(get_current_active_superuser),
session: Session = Depends(get_session),
current_user: Annotated[User, Depends(get_current_active_superuser)],
session: Annotated[Session, Depends(get_session)],
) -> dict:
"""
Delete a user from the database.

View file

@ -23,15 +23,15 @@ __all__ = [
"chains",
"documentloaders",
"embeddings",
"prompts",
"prototypes",
"models",
"helpers",
"inputs",
"link_extractors",
"memories",
"outputs",
"models",
"output_parsers",
"outputs",
"prompts",
"prototypes",
"retrievers",
"textsplitters",
"toolkits",

View file

@ -68,7 +68,7 @@ class CrewAIAgentComponent(Component):
]
def build_output(self) -> Agent:
kwargs = self.kwargs if self.kwargs else {}
kwargs = self.kwargs or {}
agent = Agent(
role=self.role,
goal=self.goal,
@ -76,7 +76,7 @@ class CrewAIAgentComponent(Component):
llm=self.llm,
verbose=self.verbose,
memory=self.memory,
tools=self.tools if self.tools else [],
tools=self.tools or [],
allow_delegation=self.allow_delegation,
allow_code_execution=self.allow_code_execution,
**kwargs,

View file

@ -114,7 +114,7 @@ class SequentialTaskAgentComponent(Component):
llm=self.llm,
verbose=self.verbose,
memory=self.memory,
tools=self.tools if self.tools else [],
tools=self.tools or [],
allow_delegation=self.allow_delegation,
allow_code_execution=self.allow_code_execution,
**agent_kwargs,

View file

@ -143,7 +143,7 @@ class AssemblyAITranscriptionJobCreator(Component):
self.status = "Error: Expected Number of Speakers must be a valid integer"
return Data(data={"error": "Error: Expected Number of Speakers must be a valid integer"})
language_code = self.language_code if self.language_code else None
language_code = self.language_code or None
config = aai.TranscriptionConfig(
speech_model=self.speech_model,

View file

@ -10,10 +10,10 @@ from .run import AssistantsRun
__all__ = [
"AstraAssistantManager",
"AssistantsCreateAssistant",
"AssistantsCreateThread",
"AssistantsGetAssistantName",
"AssistantsListAssistants",
"AssistantsCreateThread",
"AssistantsRun",
"GetEnvVar",
"Dotenv",
"GetEnvVar",
]

View file

@ -125,7 +125,7 @@ class APIRequestComponent(Component):
body = None
raise ValueError(msg) from e
data = body if body else None
data = body or None
try:
response = await client.request(method, url, headers=headers, json=data, timeout=timeout)

Some files were not shown because too many files have changed in this diff Show more