forked from langchain4j/langchain4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Register tools programmatically
- Loading branch information
1 parent
86fbc5b
commit fae22cb
Showing
5 changed files
with
167 additions
and
7 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
langchain4j-core/src/main/java/dev/langchain4j/agent/tool/ToolSomething.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package dev.langchain4j.agent.tool; | ||
|
||
import lombok.AllArgsConstructor; | ||
|
||
import java.util.function.Function; | ||
|
||
/** | ||
* TODO | ||
*/ | ||
@AllArgsConstructor // TODO | ||
public class ToolSomething { | ||
// TODO name | ||
// TODO location | ||
|
||
private final String name; | ||
private final String description; | ||
private final Class<?> argumentClass; // TODO needed? can get from function? | ||
private final Function<?, ?> function; | ||
|
||
public String name() { | ||
return name; | ||
} | ||
|
||
public String description() { | ||
return description; | ||
} | ||
|
||
public Class<?> argumentClass() { | ||
return argumentClass; | ||
} | ||
|
||
public Function<?, ?> function() { | ||
return function; | ||
} | ||
|
||
// TODO ctor? builder? | ||
public static <T> ToolSomething from(String name, | ||
String description, | ||
Class<T> argumentClass, | ||
Function<T, ?> function) { | ||
return new ToolSomething(name, description, argumentClass, function); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
langchain4j/src/main/java/dev/langchain4j/agent/tool/DefaultFunctionToolExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.langchain4j.agent.tool; | ||
|
||
public class DefaultFunctionToolExecutor implements ToolExecutor { | ||
|
||
|
||
|
||
@Override | ||
public String execute(ToolExecutionRequest toolExecutionRequest, Object memoryId) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters