You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/zhipuai-embeddings.adoc
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,13 @@ You will need to create an API with ZhiPuAI to access ZhiPu AI language models.
10
10
11
11
Create an account at https://open.bigmodel.cn/login[ZhiPu AI registration page] and generate the token on the https://open.bigmodel.cn/usercenter/apikeys[API Keys page].
12
12
13
-
The Spring AI project defines a configuration property named `spring.ai.zhipu.api-key` that you should set to the value of the `API Key` obtained from the API Keys page.
13
+
The Spring AI project defines a configuration property named `spring.ai.zhipuai.api-key` that you should set to the value of the `API Key` obtained from the API Keys page.
14
14
15
15
You can set this configuration property in your `application.properties` file:
16
16
17
17
[source,properties]
18
18
----
19
-
spring.ai.zhipu.api-key=<your-zhipu-api-key>
19
+
spring.ai.zhipuai.api-key=<your-zhipuai-api-key>
20
20
----
21
21
22
22
For enhanced security when handling sensitive information like API keys, you can use Spring Expression Language (SpEL) to reference an environment variable:
@@ -26,22 +26,22 @@ For enhanced security when handling sensitive information like API keys, you can
26
26
# In application.yml
27
27
spring:
28
28
ai:
29
-
zhipu:
30
-
api-key: ${ZHIPU_API_KEY}
29
+
zhipuai:
30
+
api-key: ${ZHIPUAI_API_KEY}
31
31
----
32
32
33
33
[source,bash]
34
34
----
35
35
# In your environment or .env file
36
-
export ZHIPU_API_KEY=<your-zhipu-api-key>
36
+
export ZHIPUAI_API_KEY=<your-zhipuai-api-key>
37
37
----
38
38
39
39
You can also set this configuration programmatically in your application code:
40
40
41
41
[source,java]
42
42
----
43
43
// Retrieve API key from a secure source or environment variable
44
-
String apiKey = System.getenv("ZHIPU_API_KEY");
44
+
String apiKey = System.getenv("ZHIPUAI_API_KEY");
45
45
----
46
46
47
47
=== Add Repositories and BOM
@@ -228,7 +228,7 @@ Next, create an `ZhiPuAiEmbeddingModel` instance and use it to compute the simil
228
228
229
229
[source,java]
230
230
----
231
-
var zhiPuAiApi = new ZhiPuAiApi(System.getenv("ZHIPU_AI_API_KEY"));
231
+
var zhiPuAiApi = new ZhiPuAiApi(System.getenv("ZHIPUAI_API_KEY"));
232
232
233
233
var embeddingModel = new ZhiPuAiEmbeddingModel(api, MetadataMode.EMBED,
0 commit comments