Skip to content

Commit c1f2ec6

Browse files
committed
doc: Fix the Ollama hugging face support documentation
1 parent c057148 commit c1f2ec6

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/ollama-chat.adoc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You can pull the models you want to use in your application from the xref:https:
2121
ollama pull <model-name>
2222
----
2323

24-
You can also pull any of the thousands, free, xref:https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
24+
You can also pull any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
2525

2626
[source,shellscript]
2727
----
@@ -166,7 +166,7 @@ TIP: In addition to the model specific link:https://github.com/spring-projects/s
166166
Spring AI Ollama can automatically pull models when they are not available in your Ollama instance.
167167
This feature is particularly useful for development and testing as well as for deploying your applications to new environments.
168168

169-
TIP: You can also pull, by name, any of the thousands, free, xref:https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models].
169+
TIP: You can also pull, by name, any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models].
170170

171171
There are three strategies for pulling models:
172172

@@ -280,6 +280,21 @@ image::spring-ai-ollama-over-openai.jpg[Ollama OpenAI API compatibility, 800, 60
280280

281281
Check the link:https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/proxy/OllamaWithOpenAiChatModelIT.java[OllamaWithOpenAiChatModelIT.java] tests for examples of using Ollama over Spring AI OpenAI.
282282

283+
== HuggingFace Models
284+
285+
Ollama can access, out of the box, all https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face ] Chat Models.
286+
You can pull any of these models by name: `ollama pull hf.co/<username>/<model-repository>` or configure the auto-pulling strategy: xref:auto-pulling-models[Auto-pulling Models]:
287+
288+
[source]
289+
----
290+
spring.ai.ollama.chat.options.model=hf.co/bartowski/gemma-2-2b-it-GGUF
291+
spring.ai.ollama.init.pull-model-strategy=always
292+
----
293+
294+
- `spring.ai.ollama.chat.options.model`: Specifies the https://huggingface.co/models?library=gguf&sort=trending[Hugging Face GGUF model] to use.
295+
- `spring.ai.ollama.init.pull-model-strategy=always`: (optional) Enables automatic model pulling at startup time.
296+
For production, you should pre-download the models to avoid delays: `ollama pull hf.co/bartowski/gemma-2-2b-it-GGUF`.
297+
283298
== Sample Controller
284299

285300
https://start.spring.io/[Create] a new Spring Boot project and add the `spring-ai-ollama-spring-boot-starter` to your pom (or gradle) dependencies.

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/ollama-embeddings.adoc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You can pull the models you want to use in your application from the https://oll
2222
ollama pull <model-name>
2323
----
2424

25-
You can also pull any of the thousands, free, xref:https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
25+
You can also pull any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
2626

2727
[source,shellscript]
2828
----
@@ -166,7 +166,7 @@ EmbeddingResponse embeddingResponse = embeddingModel.call(
166166
Spring AI Ollama can automatically pull models when they are not available in your Ollama instance.
167167
This feature is particularly useful for development and testing as well as for deploying your applications to new environments.
168168

169-
TIP: You can also pull, by name, any of the thousands, free, xref:https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models].
169+
TIP: You can also pull, by name, any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models].
170170

171171
There are three strategies for pulling models:
172172

@@ -222,6 +222,21 @@ spring:
222222

223223
This configuration will apply the pulling strategy to all models except embedding models.
224224

225+
== HuggingFace Models
226+
227+
Ollama can access, out of the box, all https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face] Embedding models.
228+
You can pull any of these models by name: `ollama pull hf.co/<username>/<model-repository>` or configure the auto-pulling strategy: xref:auto-pulling-models[Auto-pulling Models]:
229+
230+
[source]
231+
----
232+
spring.ai.ollama.embedding.options.model=hf.co/mixedbread-ai/mxbai-embed-large-v1
233+
spring.ai.ollama.init.pull-model-strategy=always
234+
----
235+
236+
- `spring.ai.ollama.embedding.options.model`: Specifies the https://huggingface.co/models?library=gguf&sort=trending[Hugging Face GGUF model] to use.
237+
- `spring.ai.ollama.init.pull-model-strategy=always`: (optional) Enables automatic model pulling at startup time.
238+
For production, you should pre-download the models to avoid delays: `ollama pull hf.co/mixedbread-ai/mxbai-embed-large-v1`.
239+
225240
== Sample Controller
226241

227242
This will create a `EmbeddingModel` implementation that you can inject into your class.

0 commit comments

Comments
 (0)