Commit Graph

696 Commits

Author SHA1 Message Date
QuantumGhost 5cb24625c3 ci(python): Add CI Pipeline for Python SDK (#72)
* chore(python): temporarily disable `UP007` rule in Ruff

Disable the `UP007` rule temporarily due to numerous existing
violations in the current codebase.

* ci(python): add lint and test for Python SDK

* ci: Add mega-linter

* chore(python): Add final newline to markdown files

* fix(python): Fix linter issues by using ruff's auto fix

* fix(python): Fix TRY400 linter violations

Ruff suggests using `logger.exception` to log when
logging an exception, instead of using `logging.error`.

The former logs the exception and the traceback
automatically.

ref: https://docs.astral.sh/ruff/rules/error-instead-of-exception/

* fix(python): fix ruff linter violations

* test(python): Add Test cases for LLM entities

Test the initialization of `LLMResult` and `LLMResultChunk`.

* test(python): Add test for `AgentModelConfig`

Ensures that the `history_prompt_messages` attribute is
not shared between instances of `AgentModelConfig`.

* chore(python): output diffs in Ruff's format check

* style(python): format code with Ruff

* chore(python): Add a bash script for fix and format python code

* chore: add `persist-credentials: false` to checkout action

Enhances security by preventing subsequent
steps from accessing GitHub credentials, reducing
potential attack surfaces.

Ref: https://github.com/actions/checkout#checkout-v4
2025-04-14 20:25:19 +08:00
非法操作 bc4ee91294 add self.session.storage.exist (#89) 2025-04-14 20:05:33 +08:00
Yeuoly 0d47adb19f feat: add minimum_dify_version field to PluginConfiguration for version validation (#93) 2025-04-14 20:04:43 +08:00
Yeuoly 12ad9db9b5 enhancement: remove prompt_messages from LLMResult and LLMResultChunk (#88)
* refactor: remove prompt_messages from LLMResult and LLMResultChunk

* fix: add backward compatibility for deprecated prompt_messages field in LLMResult and LLMResultChunk

* fix: set default value for prompt_messages field to an empty list in LLMResult and LLMResultChunk for backward compatibility

* feat: add test for LLMResult to validate prompt_messages field and ensure backward compatibility

* apply ruff
2025-04-11 15:23:05 +08:00
晴天娃娃 94e36a4e48 Fix: Convert shared class variables to instance variables in RequestReader to solve lock contention and CPU deadlock issues (#81) 2025-04-11 15:20:35 +08:00
Yeuoly 3976439a6d Update README.md 2025-04-11 13:29:16 +08:00
Yeuoly 8310e77533 chore: update Python SDK version to 0.1.0 and add README for Dify Plugin SDK 2025-04-10 14:56:55 +08:00
Yeuoly f42fd51aed docs: add README for Dify Plugin SDK with version management guidelines 2025-04-10 14:52:33 +08:00
Vitor 6860f207c2 fix: ensure string fields in ToolCall default to empty string during initialization if set to explicit None (#82) 2025-04-10 14:45:39 +08:00
Yeuoly 957aab49cd fix: improve gevent socket connection handling, avoid blocking except… (#86)
* fix: improve gevent socket connection handling, avoid blocking exceptions

* fix: enhance TCP socket handling with thread safety and improved data transmission
2025-04-10 13:42:35 +08:00
3Dify-developer 579f26f67a chore: update pydantic-settings version to >=2.5.0 (#80)
* chore: update pydantic-settings version to >=2.5.0

* chore: limit pydantic-settings < v3.0.0
2025-04-09 20:09:47 +08:00
Junyan Qin (Chin) 0216ed8187 feat: add supports for provider to register array[tool] type field (#78) 2025-04-07 16:14:36 +08:00
helojo 996ca2af6c socket recv cache up to 1M (#75)
Co-authored-by: zqgame <zqgame@zqgame.local>
2025-04-07 11:14:52 +09:00
呆萌闷油瓶 ecbb098877 chore:sync openai_compatible/llm.py from 0.15.3 (#71)
* sync from 0.15.3

* fix conflict

* fix conflict
2025-04-01 01:26:01 +09:00
Yeuoly 46cc404d2e fix: bump sdk version to beta76 2025-03-29 01:55:53 +09:00
-LAN- b3dac93c99 fix(entities/model/message): prompt message cannot validate when pass multi type contents (#73) 2025-03-28 10:58:42 +09:00
Novice 4fb304570e bump version to 0.0.1-beta75 2025-03-27 09:20:53 +08:00
Novice 7a96b3ba12 Merge pull request #63 from langgenius/feat/agent-memory
feat: add history message feature
2025-03-27 09:16:59 +08:00
Novice ad5f121274 chore: lock version 2025-03-27 09:14:33 +08:00
Novice 51a2793c47 Merge branch 'main' into chore/upgrade-yarl-version 2025-03-27 09:13:31 +08:00
Novice a90dd6782b fix: ReAct Agent add memory 2025-03-26 16:53:36 +08:00
Novice 72d3e1ad03 Merge branch 'main' into feat/agent-memory 2025-03-26 13:20:06 +08:00
QuantumGhost ef530695c7 feat(python): Enable Ruff ruleset (RUF), disable preview mode (#70)
* feat(python): Enable Ruff ruleset (RUF)

Refactor the codebase to address and resolve pre-existing style
violations flagged by the Ruff ruleset.

* feat(python): disable preview mode in Ruff

Preview rules in Ruff are unstable and subject to frequent changes.
Disabling them helps prevent potential confusion for developers.

* chore(python): disable deprecated UP038 rule in Ruff

The UP038 rule is deprecated and its suggested practice is not recommended.
Disabling this rule helps avoid unnecessary code rewrites.
2025-03-25 23:23:00 +09:00
Novice f1e62ad85b chore: update dependency constraint for pydantic 2025-03-25 08:45:02 +08:00
Novice 4dac802553 Merge branch 'main' into chore/upgrade-yarl-version 2025-03-25 08:44:42 +08:00
QuantumGhost bf79e6591d feat(python): Enable pycodestyle (W) warning ruleset with ruff (#69)
Refactor codebase to fix pre-existing style issues flagged by the ruleset.
2025-03-24 19:21:00 +08:00
QuantumGhost c83c6f41ed feat(python): Enforce FBT003 rule in ruff for boolean arguments (#68)
Configure ruff to require boolean arguments to be passed as keyword arguments in function calls.
This enhances code readability and clarity at call sites.
2025-03-24 19:15:08 +08:00
QuantumGhost 22ae421dd6 feat(python): Integrate flake8-builtins (A) ruleset with ruff (#66)
Introduce the flake8-builtins (A) ruleset to prevent accidental shadowing
of Python's built-in functions.

Address existing issues primarily by adding `# noqa` to suppress warnings where necessary.
2025-03-24 18:58:50 +08:00
QuantumGhost 4eb0de0857 feat(python): Introduct flake8-debugger (T10) ruleset with ruff (#67)
Prohibit calls to `breakpoint()` in committed code.
2025-03-24 18:54:40 +08:00
QuantumGhost 9e084d7d09 feat(python): upgrade ruff to v0.11.2, integrate flake8-bandit ruleset for security linting (#65)
* chore(python): update .gitignore for Python SDK

Adjust .gitignore for Python SDK based on the templated generated by
gitignore.io, with minor custom modifications.

* chore: add .editorconfig for consistent formatting

Add a .editorconfig file to enforce consistent file encoding,
indentation, and end-of-line characters across the project.

* chore(python): upgrade ruff version to v0.11.2

* feat(python): Integrate flake8-bandit ruleset for security linting

Enable the flake8-bandit (S) ruleset in ruff to enforce security-related
best practices and mitigate potential vulnerabilities in the codebase.

Suppress existing issues in the current code using `noqa` comments, primarily for
instances of `requests` calls without a specified `timeout` parameter.
2025-03-24 18:00:14 +08:00
GumKey a4da30d106 fix:add function to validate only stream mode model credentials (#47)
* fix:add function to validate only stream mode model credentials

* fix:add function to validate only stream mode model credentials

* fix:add function to validate only stream mode model credentials

* update: Stream credentials validation failed

* update: Stream credentials validation failed

---------

Co-authored-by: Xenos <sm2052@admindeMacBook-Pro.local>
2025-03-24 17:38:02 +08:00
kurokobo b0822102ed fix: bypass _code_block_mode_wrapper if response_format is not JSON or XML (#57) 2025-03-24 17:36:18 +08:00
Dongyu Li cff2ee2855 Fix/file upload (#62)
* fix:Change the file upload check parameter type to an optional parameter.

* feat:UploadFileResponse add preview_url

* feat:UploadFileResponse add preview_url
2025-03-24 17:35:09 +08:00
Novice 193c061333 feat: add history message feature 2025-03-24 09:20:08 +08:00
bxfxf 0649853867 fix:Let OAICompatLargeLanguageModel compatible with the ​data: format for streaming response messages (#54) 2025-03-21 21:25:04 +08:00
Novice 46ca484beb chore: update dependency constraint for yarl 2025-03-21 09:53:41 +08:00
Novice c80184c5c1 Merge branch 'main' into feat/agent-memory 2025-03-19 09:09:30 +08:00
Novice 7012b6099a feat: add llm blocking invoke (#40)
* feat: add llm blocking invoke

* fix: switch to using generator to handle non-streaming requests

* fix: type issues

---------

Co-authored-by: Yeuoly <45712896+Yeuoly@users.noreply.github.com>
2025-03-18 19:05:42 +08:00
Yeuoly b2ace32a05 bump version to 0.0.1-beta74 2025-03-18 18:49:54 +08:00
jcvv0n 7b578d3694 Fix the error in running the agent plugin (#45) 2025-03-18 17:45:19 +08:00
Yeuoly 43c566799e bump version to 0.0.1-beta74 2025-03-18 17:41:43 +08:00
-LAN- 967084177f fix: Update prompt message content types to use Literal and add union type for content (#49)
Signed-off-by: -LAN- <laipz8200@outlook.com>
2025-03-17 17:28:21 +08:00
Novice 4f5d318030 feat: agent node add memory 2025-03-17 14:51:29 +08:00
-LAN- b7a30ae78a fix: cannot init prompt message (#42)
* chore(*): Add pytest into test group

Signed-off-by: -LAN- <laipz8200@outlook.com>

* fix: Enhance content transformation to support Sequence type and add unit tests

Signed-off-by: -LAN- <laipz8200@outlook.com>

---------

Signed-off-by: -LAN- <laipz8200@outlook.com>
2025-03-14 13:36:48 +08:00
Yeuoly c40344f44f bump sdk to beta 73 2025-03-12 20:18:41 +08:00
Yeuoly eb19d27501 feat: Add connection lifetime timeout for serverless request reader (#38)
- Implement timeout mechanism for single connection lifetime
- Prevent indefinite blocking on queue retrieval
- Refresh connection timer on each successful response
- Handle queue timeout gracefully
2025-03-12 17:57:15 +08:00
Dongyu Li f885a90d09 fix:Change the file upload check parameter type to an optional parameter. (#37) 2025-03-12 17:35:51 +08:00
非法操作 51341c56a5 migrate the <think> tag (#33) 2025-03-12 13:14:52 +08:00
Yeuoly b936b1be9f fix: flush output when initialize 2025-03-07 16:14:16 +08:00
Yeuoly 7cb4b8a00a chore: Bump version to 0.0.1-beta71 and add server startup logging 2025-03-06 17:53:03 +08:00