Skip to content

Commit e65665b

Browse files
committed
chore: update prompt
Signed-off-by: yuluo-yx <yuluo08290126@gmail.com>
1 parent 9b3e1a4 commit e65665b

File tree

19 files changed

+285
-81
lines changed

19 files changed

+285
-81
lines changed

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
<module>spring-ai-alibaba-nacos-example</module>
7272
<module>spring-ai-alibaba-integration-example</module>
7373
<module>spring-ai-alibaba-more-platform-and-model-example</module>
74+
<module>spring-ai-alibaba-text-summarizer-example</module>
75+
<module>spring-ai-alibaba-sql-example</module>
76+
<module>spring-ai-alibaba-text-classification-example</module>
7477
</modules>
7578

7679
<dependencyManagement>

spring-ai-alibaba-integration-example/backend/src/main/java/com/alibaba/cloud/ai/application/controller/SAAWebSearchController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
/**
1515
* @author yuluo
1616
* @author <a href="mailto:yuluo08290126@gmail.com">yuluo</a>
17+
*
18+
* 默认使用 deepseek-r1 模型,效果更好。
1719
*/
1820

1921
@RestController

spring-ai-alibaba-integration-example/backend/src/main/java/com/alibaba/cloud/ai/application/service/SAAChatService.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,13 @@ public SAAChatService(
5858
5959
在回答用户问题是,你需要遵守以下约定:
6060
61-
1. 如果答案不在上下文中,就说你不知道;
62-
2. 不要提供任何与问题无关的信息,也不要输出任何的重复内容;
63-
3. 避免使用 “基于上下文...” 或 “The provided information...” 的说法;
64-
4. 你的答案必须正确、准确,并使用专家般公正和专业的语气撰写;
65-
5. 回答中适当的文本结构是根据内容的特点来确定的,请在输出中包含副标题以提高可读性;
66-
6. 生成回复时,先提供明确的结论或中心思想,不需要带有标题;
67-
7. 确保每个部分都有清晰的副标题,以便用户可以更好地理解和参考你的输出内容;
68-
8. 如果信息复杂或包含多个部分,请确保每个部分都有适当的标题以创建分层结构。
61+
1. 不要提供任何与问题无关的信息,也不要输出任何的重复内容;
62+
2. 避免使用 “基于上下文...” 或 “The provided information...” 的说法;
63+
3. 你的答案必须正确、准确,并使用专家般公正和专业的语气撰写;
64+
4. 回答中适当的文本结构是根据内容的特点来确定的,请在输出中包含副标题以提高可读性;
65+
5. 生成回复时,先提供明确的结论或中心思想,不需要带有标题;
66+
6. 确保每个部分都有清晰的副标题,以便用户可以更好地理解和参考你的输出内容;
67+
7. 如果信息复杂或包含多个部分,请确保每个部分都有适当的标题以创建分层结构。
6968
7069
如果用户问到了有关于 Spring AI Alibaba 或者 Spring AI 的问题,在回答用户问题之后,
7170
引导用户到 Spring AI Alibaba 项目官网 https://java2ai.com 以查看更多信息。
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
# 使用 Spring AI Alibaba 总结文本内容
1+
# 使用 Spring AI Alibaba 执行 SQL
22

33
使用示例
44

55
```shell
6-
curl -X POST -F file='./saa.pdf' http://localhost:10091/summarize
6+
curl localhost:10092/sql \
7+
-H"Content-type: application/json" \
8+
-d'{"question":"How many books has Craig Walls written?"}'
9+
```
10+
11+
返回值
12+
13+
```json
14+
{
15+
"sqlQuery": "SELECT COUNT(*) FROM Books INNER JOIN Authors ON Books.author_ref = Authors.id WHERE Authors.firstName = 'Craig' AND Authors.lastName = 'Walls'",
16+
"results": [
17+
{
18+
"COUNT(*)": 4
19+
}
20+
]
21+
}
722
```

spring-ai-alibaba-sql-example/pom.xml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
<relativePath>../pom.xml</relativePath>
2828
</parent>
2929

30-
<artifactId>spring-ai-alibaba-text-summarizer-example</artifactId>
30+
<artifactId>spring-ai-alibaba-sql-example</artifactId>
3131
<version>0.0.1-SNAPSHOT</version>
32-
<name>Spring AI Alibaba Text Summarizer Example</name>
33-
<description>Spring AI Alibaba Text Summarizer Example</description>
32+
<name>Spring AI Alibaba SQL Example</name>
33+
<description>Spring AI Alibaba SQL Example</description>
3434

3535
<properties>
3636
<maven.compiler.source>17</maven.compiler.source>
@@ -51,8 +51,14 @@
5151
</dependency>
5252

5353
<dependency>
54-
<groupId>org.springframework.ai</groupId>
55-
<artifactId>spring-ai-tika-document-reader</artifactId>
54+
<groupId>org.springframework.boot</groupId>
55+
<artifactId>spring-boot-starter-jdbc</artifactId>
56+
</dependency>
57+
58+
<dependency>
59+
<groupId>com.h2database</groupId>
60+
<artifactId>h2</artifactId>
61+
<scope>runtime</scope>
5662
</dependency>
5763
</dependencies>
5864

spring-ai-alibaba-sql-example/src/main/java/com/alibaba/example/sql/SQLApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.alibaba.example.summarizer;
1+
package com.alibaba.example.sql;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;

spring-ai-alibaba-sql-example/src/main/java/com/alibaba/example/sql/SQLGenerationException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.alibaba.example.summarizer;
1+
package com.alibaba.example.sql;
22

33
public class SQLGenerationException extends RuntimeException {
44

spring-ai-alibaba-sql-example/src/main/java/com/alibaba/example/sql/SQLGenerationExceptionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.alibaba.example.summarizer;
1+
package com.alibaba.example.sql;
22

33
import org.springframework.http.HttpStatus;
44
import org.springframework.http.ProblemDetail;

spring-ai-alibaba-sql-example/src/main/java/com/alibaba/example/sql/controller/SQLController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.alibaba.example.summarizer.controller;
1+
package com.alibaba.example.sql.controller;
22

33
import java.io.IOException;
44
import java.nio.charset.Charset;
55
import java.util.List;
66
import java.util.Map;
77

8-
import com.alibaba.example.summarizer.SQLGenerationException;
8+
import com.alibaba.example.sql.SQLGenerationException;
99

1010
import org.springframework.ai.chat.client.ChatClient;
1111
import org.springframework.beans.factory.annotation.Value;
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
server:
2-
port: 10091
2+
port: 10092
33

44
spring:
55
application:
6-
name: spring-ai-alibaba-text-summarizer-example
6+
name: spring-ai-alibaba-sql-example
77

88
ai:
99
dashscope:
1010
api-key: ${AI_DASHSCOPE_API_KEY}
11-
12-
servlet:
13-
multipart:
14-
max-file-size: 5MB

0 commit comments

Comments
 (0)