feat: Enhance agent functionality with ModelProfile integration

- Added ModelProfile to the Agent record to allow for more detailed model configurations.
- Updated AgentExecutorService to utilize ModelProfile when fetching clients.
- Modified BaseAgent interface to include a default modelProfile method.
- Adjusted Client interface and implementations to support ModelProfile in conversation and streaming methods.
- Enhanced ClientService to retrieve clients based on ModelProfile.
- Updated CompletionInterceptor to work with ModelProfile instead of ModelCategory.
- Refactored AzureAiClient and other client implementations to handle ModelProfile correctly.
- Changed CachedClient to cache responses based on ModelProfile.
- Updated ModelCategory to a record type for better validation and immutability.
- Enhanced ModelProfile with validation checks for its fields.
- Updated ModelProfileService to support fetching profiles based on ModelCategory.
- Adjusted tests to accommodate changes in Agent and ModelProfile.
- Updated properties files to include category information for model profiles.
This commit is contained in:
extio-de
2025-10-29 12:07:36 +01:00
parent c5dca3ac07
commit 304924e223
20 changed files with 452 additions and 126 deletions

View File

@@ -53,6 +53,7 @@ public class AgentTest {
new Agent("CodeSummarizer",
AgentType.START_CONVERSATION,
ModelCategory.MEDIUM,
null,
"Generate a summary of the following Java source code.",
"The source code is:\n{{code}}",
new TextAgentResponseHandler("summary"),
@@ -65,6 +66,7 @@ public class AgentTest {
new Agent("FeatureIdentifier",
AgentType.CONVERSATION,
ModelCategory.MEDIUM,
null,
"",
"Generate a list of 5 distinct functional features. In scope is business logic, not code mechanics. Provide no preamble and no explanation. Return the response in JSON format with the following field: { \"features\": [\"Feature 1\", \"Feature 2\", ... ] }",
new JsonAgentResponseHandler(),
@@ -77,6 +79,7 @@ public class AgentTest {
new Agent("FeatureAnalyzer",
AgentType.COMPLETION,
ModelCategory.MEDIUM,
null,
"Analyze a feature of the following Java source code and describe the functionality and purpose of this feature. Only describe the implementation, don't suggest any possible improvements.",
"""
The source code is:
@@ -92,6 +95,7 @@ public class AgentTest {
new Agent("AnswerGenerator",
AgentType.COMPLETION,
ModelCategory.MEDIUM,
null,
"Generate a clear and concise blog post for an announcement from the following code analysis.",
"""
Write a concise description of the purpose in the blog post first and then concise information for the following topics: {{topics}}
@@ -131,6 +135,7 @@ public class AgentTest {
new Agent("CodeSummarizer",
AgentType.START_CONVERSATION,
ModelCategory.MEDIUM,
null,
"Generate a summary of the following Java source code.",
"The source code is:\n{{code}}",
new TextAgentResponseHandler("summary",
@@ -179,6 +184,7 @@ public class AgentTest {
new Agent("FirstLevel",
AgentType.COMPLETION,
ModelCategory.MEDIUM,
null,
"",
"Generate 5 random numbers from 1 to 10. Provide no preamble and no explanation. Return the response in JSON format with the following field: { \"numbers\": [\"Number 1\", \"Number 2\", ... ] }",
new JsonAgentResponseHandler(),
@@ -191,6 +197,7 @@ public class AgentTest {
new Agent("SecondLevel",
AgentType.COMPLETION,
ModelCategory.MEDIUM,
null,
"",
"Generate 5 random numbers from 1 to 10. The previous number was [[numbers]]. Provide no preamble and no explanation. Return the response in JSON format with the following field: { \"random\": [\"Number 1\", \"Number 2\", ... ] }",
new JsonAgentResponseHandler(),
@@ -203,6 +210,7 @@ public class AgentTest {
new Agent("Calculator",
AgentType.COMPLETION,
ModelCategory.MEDIUM,
null,
"",
"Add these 2 numbers: {{numbers}} + [[random]] ; Provide no preamble and no explanation. Return the response in JSON format with the following field: { \"result\": \"result\" }",
new JsonAgentResponseHandler(),
@@ -215,6 +223,7 @@ public class AgentTest {
new Agent("Grader",
AgentType.COMPLETION,
ModelCategory.MEDIUM,
null,
"You are a helpful assistant.",
"If you add {{numbers}} marbles to {{random}} marbles, do you get {{result}} marbles as the result? Answer with 'yes' or 'no'",
new TextAgentResponseHandler("grade"),

View File

@@ -1,3 +1,4 @@
category=
prompts=
tokenEncoding=cl100k_base
maxTokens=1500

View File

@@ -1,3 +1,4 @@
category=M
prompts=
tokenEncoding=cl100k_base
maxTokens=2500

View File

@@ -1,3 +1,4 @@
category=S
prompts=gpt-oss
tokenEncoding=cl100k_base
maxTokens=2500