Skip to content

Commit 079e1b7

Browse files
committed
Tool group selection
1 parent 1c18276 commit 079e1b7

6 files changed

Lines changed: 53 additions & 167 deletions

File tree

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
<version>${embabel-agent.version}</version>
3737
</dependency>
3838

39+
<dependency>
40+
<groupId>com.embabel.agent</groupId>
41+
<artifactId>embabel-agent-rag-lucene</artifactId>
42+
<version>${embabel-agent.version}</version>
43+
</dependency>
44+
3945
<dependency>
4046
<groupId>com.embabel.agent</groupId>
4147
<artifactId>embabel-agent-test</artifactId>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.embabel.coding;
2+
3+
import com.embabel.agent.rag.RagService;
4+
import com.embabel.agent.rag.lucene.LuceneRagService;
5+
import org.springframework.context.annotation.Bean;
6+
import org.springframework.context.annotation.Configuration;
7+
8+
@Configuration
9+
public class ReferenceConfiguration {
10+
11+
@Bean
12+
public RagService ragService() {
13+
return new LuceneRagService(
14+
"code ref",
15+
"code description"
16+
);
17+
}
18+
}

src/main/java/com/embabel/coding/Tyrell.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.embabel.coding;
22

33
import com.embabel.agent.api.annotation.*;
4+
import com.embabel.agent.api.common.LlmReference;
45
import com.embabel.agent.api.common.OperationContext;
5-
import com.embabel.agent.api.common.ToolObject;
66
import com.embabel.agent.domain.library.code.SoftwareProject;
77
import com.embabel.agent.spi.ToolGroupResolver;
8-
import com.embabel.agent.tools.common.LlmReference;
98
import com.embabel.coding.tools.api.ApiReference;
109
import com.embabel.coding.tools.git.RepositoryReferenceProvider;
1110
import com.embabel.coding.tools.jvm.ClassGraphApiReferenceExtractor;
@@ -42,6 +41,7 @@ public Tyrell(Config config, ToolGroupResolver toolGroupResolver) {
4241
.cloneRepository("https://github.com/embabel/embabel-agent-examples.git");
4342
references.add(embabelApiReference);
4443
references.add(examplesReference);
44+
references.add(softwareProject);
4545
}
4646

4747

@@ -77,16 +77,12 @@ AgentCreationRequest requestAgentDetails() {
7777
public AgentCreationResult createAgent(AgentCreationRequest request, OperationContext embabel) {
7878
return embabel.ai()
7979
.withLlm(config.codingLlm)
80-
.withPromptElements(references)
81-
// TODO need withToolObjects method in API
82-
.withToolObject(new ToolObject(references.get(0)).withNamingStrategy(n -> "api_ref_" + n))
83-
.withToolObject(new ToolObject(references.get(1)).withNamingStrategy(n -> "examples_repo_" + n))
84-
.withToolObject(new ToolObject(softwareProject).withNamingStrategy(n -> "this_project_" + n))
85-
.withPromptElements(softwareProject)
80+
.withReferences(references)
8681
.withTemplate("coding/creator")
8782
.createObject(
8883
AgentCreationResult.class,
8984
Map.of(
85+
"thisProject", softwareProject.getName().replace("-", "_"),
9086
"package", request.pkg(),
9187
"purpose", request.purpose(),
9288
"toolGroups", toolGroupResolver.availableToolGroups()

src/main/java/com/embabel/joke/agent/JokeAgent.java

Lines changed: 0 additions & 144 deletions
This file was deleted.

src/main/resources/application.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
#embabel.models.embeddingServices.cheapest=nomic-embed-text:latest
1010
#
1111
#embabel.agent-platform.ranking.llm=llama3.1:8b
12-
embabel.tyrell.coding-llm.model=claude-opus-4-20250514
12+
embabel.tyrell.coding-llm.model=claude-3-7-sonnet-latest
13+
#embabel.tyrell.coding-llm.model=claude-3-5-haiku-latest
Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
Create a new Embabel agent in Java within this project.
22
This project uses normal Maven conventions.
33

4-
The package should be {{ pgk }}
5-
6-
The purpose of the agent is {{ purpose }}.
7-
8-
Choose an appropriate class name. Refer to API documentation and examples for how to build an agent.
4+
Choose an appropriate class name within the package.
5+
Refer to API documentation and examples for how to build an agent.
96

107
Start by considering the data flow between the agent's @Action methods.
118
These types should be captured in records.
129

1310
For each @Action method, consider what tool groups may be required.
1411
Be parsimonious in your choice of tool groups, including only what's necessary.
15-
The available tool groups are:
16-
17-
{% for tool_group in tool_groups %}
18-
- {{ tool_group.role }}: {{ tool_group.description }}
12+
The available tool groups are the following (use the role string in code for withToolGroup):
13+
Role | Description
14+
---- | -----------
15+
{% for group in toolGroups %}
16+
{{ group.role }} | {{ group.description }}
1917
{% endfor %}
2018

2119
Ue modern Java with vars and records.
2220

2321
Use the build tool to check that your build works and fix it if it doesn't.
2422

25-
You should also create the following artifacts:
26-
27-
1. Unit test for the new agent. Use WriteAndReviewAgentTest in this repository as a guide
23+
{#You should also create the following artifacts:#}
24+
{##}
25+
{#1. Unit test for the new agent. Use WriteAndReviewAgentTest in this repository as a guide#}
2826

2927
{#2. Integration test for the new agent. Use#}
3028

@@ -33,7 +31,18 @@ DO NOT MODIFY ANY FILES BESIDES THE NEW FILES YOU'VE CREATED
3331
DO NOT MODIFY THE pom.xml
3432

3533
Tools provided will give you access to reference repositories.
36-
The tool names beginning with "this_project_" will give you access to this repository
34+
The tool names beginning with "{{ thisProject }}" will give you access to this repository
35+
36+
This project uses normal Maven project structure, you will add source code under src/main/java and tests under src/test/java.
37+
Note that the examples repo has a different structure.
3738

3839
Create the simplest possible implementation that meets the requirements.
39-
Do not invent extra steps.
40+
Do not invent extra steps or actions.
41+
42+
# PACKAGE
43+
44+
The package should be {{ package }}
45+
46+
# PURPOSE OF THE AGENT
47+
48+
{{ purpose }}

0 commit comments

Comments
 (0)