feat(model): add support for deepseek V3.1 as llm agent. #86
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe this PR
Add support for deepseek V3.1 as llm agent. Since deepseek has a native support for tool calling, we add the corresponding main agent prompt, sub agent prompt and the corresponding llm client.
What changed?
convert_tool_definition_to_tool_callfunction to generate thetool_listin the format required by the Deepseek API. This list is passed as a parameter during message creation.process_llm_responsefunction has been updated to correctly handle responses wherefinish_reasonistool_call. Specifically, if the LLM returns onlytool_calls(llm_response.choices[0].message.tool_calls) without any accompanying text content, we now manually construct theassistant_response(the text portion of the result) to ensure broader compatibility.We have introduced new prompts tailored for Deepseek that rely on its native tool-calling capabilities rather than explicit instructions.
Main Agent Prompt: A new prompt,
MainAgentPromptBoxedDeepseek, has been created based onMainAgentPromptBoxed. The key change is the removal of the system prompt section that dictated the mcp tool-calling format. The underlying assumption is that by providing the tool_list in the API call, the model will correctly format its tool-calling responses without needing explicit syntax guidance.Sub-Agent Prompt: Similarly,
SubAgentWorkerPromptDeepSeekhas been created by removing the tool-calling syntax description from the original prompt.Why?
Current prompt assumes the tool calling in a specifc format and uses regular expression for extracting relavent information. But deepseek has a native tool calling format, so the corresponding prompt and response handling needs to be handled differently.
Checklist for PR
Write a descriptive PR title following the Angular commit message format:
<type>(<scope>): <subject>feat(agent): add pdf tool via mcp,perf: make llm client async,fix(utils): load custom config via importlibfeat,fix,docs,style,refactor,perf,test,build,ci,revertcheck-pr-titleCI job will validate your title formatUpdate README❌ Missing type and colonfeat add new feature❌ Missing colon after typeFeature: add new tool❌ Invalid type (should befeat)feat(Agent): add tool❌ Scope should be lowercasefeat(): add tool❌ Empty scope not allowedfeat(my_scope): add tool❌ Underscores not allowed in scopefeat(my space): add tool❌ Space not allowed in scopefeat(scope):add tool❌ Missing space after colonfeat(scope):❌ Empty subjectRun lint and format locally:
uv tool run [email protected] check --fix .uv tool run [email protected] format .lintenforces ruff default format/lint rules on all new codes.