Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@

package modelengine.example.ai.chat.agent.tool;

import modelengine.fel.tool.annotation.Group;
import modelengine.fel.tool.annotation.ToolMethod;
import modelengine.fitframework.annotation.Genericable;
import modelengine.fitframework.annotation.Property;

/**
* 表示天气服务的接口定义。
*
* @author 杭潇
* @author 易文渊
* @since 2024-09-02
*/
@Group(name = "weather_service")
public interface WeatherService {
/**
* 获取指定地点的当前温度。
Expand All @@ -22,15 +27,18 @@ public interface WeatherService {
* @param unit 表示温度单位的 {@link String}。
* @return 表示当前温度的 {@link String}。
*/
@ToolMethod(name = "current_temperature", description = "获取指定地点的当前温度")
@Genericable("modelengine.example.weather.temperature")
String getCurrentTemperature(String location, String unit);
String getCurrentTemperature(@Property(description = "城市名称", required = true) String location,
@Property(description = "使用的温度单位,可选:Celsius,Fahrenheit", defaultValue = "Celsius") String unit);

/**
* 获取指定地点的降雨概率。
*
* @param location 表示地点名称的 {@link String}。
* @return 表示降雨概率的 {@link String}。
*/
@ToolMethod(name = "rain_probability", description = "获取指定地点的降雨概率")
@Genericable("modelengine.example.weather.rain")
String getRainProbability(String location);
String getRainProbability(@Property(description = "城市名称", required = true) String location);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package modelengine.example.ai.chat.agent.tool;

import modelengine.fel.tool.annotation.Attribute;
import modelengine.fel.tool.annotation.Group;
import modelengine.fel.tool.annotation.ToolMethod;
import modelengine.fitframework.annotation.Component;
import modelengine.fitframework.annotation.Fitable;
Expand All @@ -15,10 +16,12 @@
/**
* 表示 {@link WeatherService} 的默认实现。
*
* @author 杭潇
* @author 易文渊
* @since 2024-09-02
*/
@Component
@Group(name = "default_weather_service")
public class WeatherServiceImpl implements WeatherService {
@Override
@Fitable("default")
Expand All @@ -28,15 +31,16 @@ public class WeatherServiceImpl implements WeatherService {
@Attribute(key = "attribute", value = "nothing"),
@Attribute(key = "attribute", value = "nothing two")
})
public String getCurrentTemperature(@Property(description = "城市名称", required = true) String location,
@Property(description = "使用的温度单位,可选:Celsius,Fahrenheit", defaultValue = "Celsius") String unit) {
@Property(description = "当前温度的结果")
public String getCurrentTemperature(String location, String unit) {
return "26";
}

@Override
@Fitable("default")
@ToolMethod(namespace = "example", name = "get_rain_probability", description = "获取指定城市下雨的概率")
public String getRainProbability(@Property(description = "城市名称", required = true) String location) {
@Property(description = "下雨的概率")
public String getRainProbability(String location) {
return "0.06";
}
}
12 changes: 9 additions & 3 deletions examples/fel-example/06-agent/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
fel:
openai:
api-base: '${api-base}'
api-key: '${your-api-key}'
api-base: 'https://api.siliconflow.cn/v1'
api-key: 'sk-izfmuercmorlnwqtzdkpgskmdjlnjdtheaaypyrfyetkcsaf'
example:
model: '${model-name}'
model: 'Qwen/Qwen2.5-7B-Instruct'


okhttp:
config-client:
cache:
max-size: 20
18 changes: 18 additions & 0 deletions framework/fel/java/components/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.fitframework.fel</groupId>
<artifactId>fel-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>fel-component-parent</artifactId>
<packaging>pom</packaging>

<modules>
<module>tool-info</module>
</modules>
</project>
65 changes: 65 additions & 0 deletions framework/fel/java/components/tool-info/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.fitframework.fel</groupId>
<artifactId>fel-component-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>tool-info</artifactId>

<properties>
<jackson.version>2.16.2</jackson.version>
</properties>

<dependencies>
<dependency>
<groupId>org.fitframework</groupId>
<artifactId>fit-util</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.16.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.fitframework</groupId>
<artifactId>fit-dependency-maven-plugin</artifactId>
<version>${fit.version}</version>
<executions>
<execution>
<id>dependency</id>
<phase>compile</phase>
<goals>
<goal>dependency</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.version}</version>
<configuration>
<archive>
<manifestEntries>
<Created-By>FIT Lab</Created-By>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
* This file is a part of the ModelEngine Project.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

package modelengine.fel.tool.info.schema;

/**
* 表示插件的字段集合。
*
* @author 李金绪
* @since 2024-10-29
*/
public interface PluginSchema {
/**
* 表示插件的校验和字段。
*/
String CHECKSUM = "checksum";

/**
* 表示插件的名称字段。
*/
String PLUGIN_NAME = "name";

/**
* 表示插件的描述字段。
*/
String DESCRIPTION = "description";

/**
* 表示插件的类型字段。
*/
String TYPE = "type";

/**
* 表示插件类型为 JAVA。
*/
String JAVA = "java";

/**
* 表示插件类型为 PYTHON。
*/
String PYTHON = "python";

/**
* 表示 JAVA 插件的坐标信息。
*/
String GROUP_ID = "groupId";

/**
* 表示 JAVA 插件的坐标信息。
*/
String ARTIFACT_ID = "artifactId";

/**
* 表示 PYTHON 插件的名称。
*/
String PYTHON_NAME = "name";

/**
* 表示插件的全名字段。
*/
String PLUGIN_FULL_NAME = "pluginFullName";

/**
* 表示插件的 JSON 文件名。
*/
String PLUGIN_JSON = "plugin.json";

/**
* 表示插件.
*/
String PLUGINS = "plugins";

/**
* 表示插件的临时目录。
*/
String TEMP_DIR = "tempDir";

/**
* 表示插件的 JAR 文件后缀名。
*/
String JAR = ".jar";

/**
* 表示 HTTP 类型的插件。
*/
String HTTP = "HTTP";

/**
* 表示插件的语言类型字段。
*/
String LANGUAGE = "language";

/**
* 表示插件的唯一性字段。
*/
String UNIQUENESS = "uniqueness";

/**
* 表示分隔符。
*/
char DOT = '.';
}
Loading