代码
代码节点支持通过编写代码来生成返回值。支持在代码节点内使用 IDE 工具,编写自定义代码逻辑,来处理输入参数并返回响应结果。
注意:
当前仅支持 Python3
code组件最大运行时间120秒,超时强制结束
代码

变量定义
声明代码中需要使用的变量。添加输入参数时需要设置参数名和变量值,其中变量值支持设置为固定值或引用上游节点的输出参数。
在代码中引用输入参数时,需要先在入参部分输入其变量名和类型,然后在函数内使用。
编写代码
def main(var_1: str, var_2: str)->dict:
{
return: {
"result": var_1 + var_2
}
}
代码节点中需要执行的代码片段。
引用变量:直接使用输入参数中的变量,通过返回一个对象来输出处理结果。
函数限制:不支持编写多个函数。即使仅有一个输出值,也务必保持以对象的形式返回。
输出
代码运行成功后,输出的参数。你可以根据实际需求,在输出结构中只保留必要的参数。
注意:需要确保此处定义的参数名、类型与代码的 return 对象完全一致。以代码节点默认提供的代码为例,输出的参数与代码中定义的 return 对象完全一致。
支持的Python模块
🔍 使用浏览器页面搜索功能(ctrl+F/cmd+F)快速定位
📧 需要其他库?请邮件至 support@gptbots.ai
当前支持的Python模块如下:
A
absl-py (2.1.0), affine (2.4.0), aiofiles (24.1.0), aiohappyeyeballs (2.6.1), aiohttp (3.11.14),aiosignal (1.3.2), altair (5.5.0), annotated-types (0.7.0), anyio (4.9.0), anytree (2.12.1),appdirs (1.4.4), argcomplete (3.6.0), argon2-cffi (23.1.0), argon2-cffi-bindings (21.2.0),arrow (1.3.0), arviz (0.21.0), asn1crypto (1.5.1), asttokens (3.0.0), async-lru (2.0.5),async-timeout (5.0.1), attrs (25.3.0), audioread (3.0.1)
B
babel (2.17.0), backcall (0.2.0), backoff (2.2.1), basemap (1.4.1), basemap_data (1.3.2),bcrypt (4.3.0), beautifulsoup4 (4.13.3), bleach (6.2.0), blinker (1.9.0), blis (1.0.1),bokeh (3.7.0), branca (0.8.1), Brotli (1.1.0)
C
cached-property (1.5.2), cachetools (5.5.2), cairocffi (1.7.1), CairoSVG (2.7.1),camelot-py (0.11.0), catalogue (2.0.10), certifi (2025.1.31), cffi (1.17.1),chardet (5.2.0), charset-normalizer (3.4.1), click (8.1.8), click-plugins (1.1.1),cligj (0.7.2), cloudpickle (3.1.1), colorama (0.4.6), colorclass (2.2.2), comm (0.2.2),compressed-rtf (1.0.6), confection (0.1.5), contourpy (1.3.1), cryptography (44.0.2),cssselect2 (0.2.1), cycler (0.12.1), cymem (2.0.11), Cython (3.0.12)
D
darkdetect (0.8.0), databricks-sql-connector (4.0.0), dataclasses (0.8), dbus-python (1.3.2),debugpy (1.8.13), decorator (5.2.1), deepdiff (8.4.2), defusedxml (0.7.1), deprecat (2.1.3),Deprecated (1.2.18), dill (0.3.9), dipy (1.10.0), dlib (19.24.2), dnspython (2.7.0),docx2txt (0.8)
E
easygui (0.98.3), ebcdic (1.1.1), EbookLib (0.17), edfio (0.4.6), eeglabio (0.0.3),einops (0.8.1), email_validator (2.2.0), entrypoints (0.4), et-xmlfile (1.0.1),exceptiongroup (1.2.2), exchange_calendars (4.8), executing (2.1.0), extract-msg (0.30.7)
F
Faker (37.0.0), fastapi (0.115.11), fastapi-cli (0.0.7), fastjsonschema (2.21.1),fastprogress (1.0.3), ffmpeg-python (0.2.0), ffmpy (0.3.0), filelock (3.18.0),fiona (1.10.1), Flask (3.1.0), flask-cors (5.0.1), Flask-Login (0.6.3), folium (0.19.5),fonttools (4.56.0), fpdf (1.7.2), fqdn (1.5.1), freetype-py (2.3.0), frozendict (2.4.6),frozenlist (1.5.0), fsspec (2025.3.0), future (1.0.0), fuzzywuzzy (0.18.0)
G
gensim (4.3.3), geographiclib (2.0), geopandas (1.0.1), geopy (2.4.1), ghostscript (0.7),gmpy2 (2.1.5), gradio (3.24.1), gradio_client (1.8.0), grpcio (1.71.0), gTTS (2.5.4)
H
h11 (0.14.0), h2 (4.2.0), h5io (0.2.4), h5netcdf (1.6.1), h5py (3.13.0),hpack (4.1.0), html5lib (1.1), httpcore (1.0.7), httptools (0.6.4), httpx (0.28.1),huggingface_hub (0.29.3), Hypercorn (0.17.3), hyperframe (6.1.0)
I
idna (3.10), imagecodecs (2024.12.30), imageio (2.37.0), imageio-ffmpeg (0.6.0),IMAPClient (3.0.1), importlib_metadata (8.6.1), importlib_resources (6.5.2),iniconfig (2.0.0), ipykernel (6.29.5), ipython (8.34.0), ipython_genutils (0.2.0),ipywidgets (8.1.5), isodate (0.7.2), isoduration (20.11.0), itsdangerous (2.2.0)
J
jax (0.5.2), jaxlib (0.5.2), jedi (0.19.2), Jinja2 (3.1.6), joblib (1.4.2),json5 (0.10.0), jsonpickle (4.0.0), jsonpointer (3.0.0), jsonschema (4.23.0),jsonschema-specifications (2024.10.1), jupyter (1.1.1), jupyter_client (8.6.3),jupyter-console (6.6.3), jupyter_core (5.7.2), jupyter-events (0.12.0),jupyter-lsp (2.2.5), jupyter_server (2.15.0), jupyter_server_terminals (0.5.3),jupyterlab (4.3.6), jupyterlab_pygments (0.3.0), jupyterlab_server (2.27.3),jupyterlab_widgets (3.0.13)
K
keras (3.9.0), kiwisolver (1.4.7), korean_lunar_calendar (0.3.1)
L
lark (1.1.8), lazy_loader (0.4), Levenshtein (0.27.1), librosa (0.11.0),linkify-it-py (2.0.3), llvmlite (0.44.0), loguru (0.7.2), lxml (5.3.1),lz4 (4.3.3)
M
Mako (1.3.9), mapclassify (2.8.1), markdown-it-py (2.2.0), markdown2 (2.5.3),markdownify (0.14.1), MarkupSafe (3.0.2), matplotlib (3.9.4), matplotlib-inline (0.1.7),matplotlib-venn (1.1.2), mdit-py-plugins (0.3.3), mdurl (0.1.2), mffpy (0.10.0),mistune (3.1.2), mizani (0.13.1), ml-dtypes (0.5.1), mne (1.9.0), mne-qt-browser (0.6.3),monotonic (1.6), more-itertools (10.6.0), moviepy (1.0.3), mpmath (1.3.0),msgpack (1.1.0), msoffcrypto-tool (5.4.2), mtcnn (0.1.1), multidict (6.2.0),multitasking (0.0.9), munch (4.0.0), munkres (1.1.4), murmurhash (1.0.10),mutagen (1.47.0)
N
namex (0.0.8), narwhals (1.31.0), nashpy (0.0.35), nbclassic (1.2.0),nbclient (0.10.2), nbconvert (7.16.6), nbformat (5.10.4), nest_asyncio (1.6.0),networkx (3.4.2), nibabel (5.3.2), nilearn (0.11.1), nltk (3.9.1),notebook (7.3.3), notebook_shim (0.2.4), numba (0.61.0), numexpr (2.10.2),numpy (1.26.4), numpy-financial (1.0.0)
O
oauthlib (3.2.2), odfpy (1.4.1), olefile (0.47), oletools (0.60),opencv-python (4.11.0), opencv-python-headless (4.11.0), openmeeg (2.5.15),openpyxl (3.1.5), opt_einsum (3.4.0), optree (0.14.1), orderly-set (5.3.0),orjson (3.10.15), oscrypto (1.2.1), overrides (7.7.0)
P
packaging (23.2), pandas (2.2.2), pandocfilters (1.5.0), paramiko (3.5.1),parso (0.8.4), pathy (0.10.2), patsy (1.0.1), pcodedmp (1.2.6),pdf2image (1.17.0), pdfkit (1.0.0), pdfminer.six (20231228), pdfplumber (0.11.5),pdfrw (0.4), pdftopng (0.2.3), peewee (3.17.9), pexpect (4.9.0), pickleshare (0.7.5),pikepdf (9.5.2), pillow (11.1.0), pip (25.0.1), pkgutil_resolve_name (1.3.10),platformdirs (4.3.6), plotly (6.0.1), plotnine (0.14.5), pluggy (1.5.0),ply (3.11), pooch (1.8.2), preshed (3.0.9), priority (2.0.0), proglog (0.1.10),prometheus_client (0.21.1), prompt_toolkit (3.0.50), propcache (0.2.1),protobuf (5.29.0), psutil (7.0.0), ptyprocess (0.7.0), pure_eval (0.2.3),py (1.11.0), py-cpuinfo (9.0.0), PyAudio (0.2.14), pybv (0.7.6),pycairo (1.27.0), pycountry (24.6.1), pycparser (2.22), pycryptodome (3.22.0),pycryptodomex (3.22.0), pydantic (2.10.6), pydantic_core (2.27.2),pydot (3.0.4), pydub (0.25.1), pydyf (0.11.0), Pygments (2.19.1),PyGObject (3.50.0), pygpu (0.7.6), pygraphviz (1.14), PyJWT (2.10.1),pyluach (2.2.0), pymatreader (1.0.0), pymc3 (3.9.3), PyMuPDF (1.25.4),PyNaCl (1.5.0), pyogrio (0.10.0), PyOpenGL (3.1.7), pyOpenSSL (25.0.0),pypandoc (1.15), pyparsing (3.2.1), pypdf (5.4.0), PyPDF2 (3.0.1),pypdfium2 (4.30.1), pyphen (0.17.2), pyproj (3.6.1), PyQt5 (5.15.9),PyQt5-sip (12.12.2), pyqtgraph (0.13.7), pyshp (2.3.1), PySide6 (6.8.2),PySocks (1.7.1), pytesseract (0.3.13), pytest (8.3.5), python-dateutil (2.9.0.post0),python-docx (1.1.2), python-dotenv (1.0.1), python-json-logger (2.0.7),python-Levenshtein (0.27.1), python-multipart (0.0.20), python-picard (0.8),python-pptx (1.0.2), pytz (2025.1), pyvista (0.44.2), pyvistaqt (0.11.2),PyWavelets (1.8.0), pyxlsb (1.0.10), PyYAML (6.0.2), pyzbar (0.1.9),pyzmq (26.3.0)
Q
QDarkStyle (3.2.3), qrcode (8.0), QtPy (2.4.3)
R
RapidFuzz (3.12.2), rarfile (4.0), rasterio (1.4.3), rdflib (7.1.3),referencing (0.36.2), regex (2024.11.6), reportlab (4.3.1), requests (2.32.3),requests-unixsocket (0.2.0), resampy (0.4.3), rfc3339_validator (0.1.4),rfc3986-validator (0.1.1), rich (13.9.4), rich-toolkit (0.11.3), rlPyCairo (0.2.0),rpds-py (0.23.1), RTFDE (0.1.1)
S
scikit-image (0.25.2), scikit-learn (1.6.1), scipy (1.15.2), scooby (0.10.0),seaborn (0.13.2), segment-analytics-python (2.2.3), semantic-version (2.10.0),semver (3.0.4), Send2Trash (1.8.3), sentencepiece (0.2.0), setuptools (75.8.2),setuptools-scm (8.2.0), shap (0.46.0), shapely (2.0.7), shellingham (1.5.4),shiboken6 (6.8.2), sip (6.7.12), six (1.17.0), slicer (0.0.8),smart-open (5.2.1), sniffio (1.3.1), snowflake-connector-python (3.14.0),snuggs (1.4.7), sortedcontainers (2.4.0), soundfile (0.13.1),soupsieve (2.5), soxr (0.5.0.post1), spacy-legacy (3.0.12),SpeechRecognition (3.14.1), srsly (2.5.1), stack_data (0.6.3),standard-aifc (3.13.0), standard-sunau (3.13.0), starlette (0.46.1),statsmodels (0.14.4), svglib (1.5.1), svgwrite (1.4.3), sympy (1.13.3)
T
tables (3.10.1), tabulate (0.9.0), taskgroup (0.2.2), tenacity (9.0.0),termcolor (2.5.0), terminado (0.18.1), text-unidecode (1.3), textblob (0.15.3),textract (1.6.5), Theano (1.0.5), thinc (9.1.1), threadpoolctl (3.6.0),thrift (0.20.0), tifffile (2025.3.13), tinycss2 (1.4.0), toml (0.10.2),tomli (2.2.1), tomlkit (0.13.2), toolz (1.0.0), tornado (6.4.2),tqdm (4.67.1), traitlets (5.14.3), trame (3.8.1), trame-client (3.6.0),trame-server (3.4.0), trame-vtk (2.8.15), trame-vuetify (2.8.1),trimesh (4.6.4), trx-python (0.3)
U
typer (0.15.2), typer-slim (0.15.2), types-python-dateutil (2.9.0.20241206),typing_extensions (4.12.2), typing_utils (0.1.0), tzdata (2025.1), tzlocal (5.3)
V
uc-micro-py (1.0.3), ujson (5.10.0), unicodedata2 (16.0.0), uri-template (1.3.0),urllib3 (1.26.19), uvicorn (0.34.0), uvloop (0.21.0)
W
vtk (9.3.1), Wand (0.6.10), wasabi (1.1.3), watchfiles (1.0.4),wcwidth (0.2.13), weasyprint (62.3), webcolors (24.11.1), webencodings (0.5.1),websocket-client (1.8.0), websockets (15.0.1), Werkzeug (3.1.3), wheel (0.45.1),widgetsnbextension (4.0.13), wordcloud (1.9.4), wrapt (1.17.2), wslink (2.3.2),wsproto (1.2.0)
X
xarray (2025.1.2), xarray-einstats (0.8.0), xgboost (2.1.4), xlrd (2.0.1),XlsxWriter (3.2.2), xmltodict (0.14.2), xyzservices (2025.1.0)
Y
yarl (1.18.3), yfinance (0.2.54)
Z
zipp (3.21.0), zopfli (0.2.3.post1)
