doc: Fix the Ollama hugging face support documentation
This commit is contained in:
@@ -21,7 +21,7 @@ You can pull the models you want to use in your application from the xref:https:
|
||||
ollama pull <model-name>
|
||||
----
|
||||
|
||||
You can also pull any of the thousands, free, xref:https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
|
||||
You can also pull any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
|
||||
|
||||
[source,shellscript]
|
||||
----
|
||||
@@ -166,7 +166,7 @@ TIP: In addition to the model specific link:https://github.com/spring-projects/s
|
||||
Spring AI Ollama can automatically pull models when they are not available in your Ollama instance.
|
||||
This feature is particularly useful for development and testing as well as for deploying your applications to new environments.
|
||||
|
||||
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].
|
||||
TIP: You can also pull, by name, any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models].
|
||||
|
||||
There are three strategies for pulling models:
|
||||
|
||||
@@ -280,6 +280,21 @@ image::spring-ai-ollama-over-openai.jpg[Ollama OpenAI API compatibility, 800, 60
|
||||
|
||||
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.
|
||||
|
||||
== HuggingFace Models
|
||||
|
||||
Ollama can access, out of the box, all https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face ] Chat Models.
|
||||
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]:
|
||||
|
||||
[source]
|
||||
----
|
||||
spring.ai.ollama.chat.options.model=hf.co/bartowski/gemma-2-2b-it-GGUF
|
||||
spring.ai.ollama.init.pull-model-strategy=always
|
||||
----
|
||||
|
||||
- `spring.ai.ollama.chat.options.model`: Specifies the https://huggingface.co/models?library=gguf&sort=trending[Hugging Face GGUF model] to use.
|
||||
- `spring.ai.ollama.init.pull-model-strategy=always`: (optional) Enables automatic model pulling at startup time.
|
||||
For production, you should pre-download the models to avoid delays: `ollama pull hf.co/bartowski/gemma-2-2b-it-GGUF`.
|
||||
|
||||
== Sample Controller
|
||||
|
||||
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.
|
||||
|
||||
@@ -22,7 +22,7 @@ You can pull the models you want to use in your application from the https://oll
|
||||
ollama pull <model-name>
|
||||
----
|
||||
|
||||
You can also pull any of the thousands, free, xref:https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
|
||||
You can also pull any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models]:
|
||||
|
||||
[source,shellscript]
|
||||
----
|
||||
@@ -166,7 +166,7 @@ EmbeddingResponse embeddingResponse = embeddingModel.call(
|
||||
Spring AI Ollama can automatically pull models when they are not available in your Ollama instance.
|
||||
This feature is particularly useful for development and testing as well as for deploying your applications to new environments.
|
||||
|
||||
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].
|
||||
TIP: You can also pull, by name, any of the thousands, free, https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face Models].
|
||||
|
||||
There are three strategies for pulling models:
|
||||
|
||||
@@ -222,6 +222,21 @@ spring:
|
||||
|
||||
This configuration will apply the pulling strategy to all models except embedding models.
|
||||
|
||||
== HuggingFace Models
|
||||
|
||||
Ollama can access, out of the box, all https://huggingface.co/models?library=gguf&sort=trending[GGUF Hugging Face] Embedding models.
|
||||
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]:
|
||||
|
||||
[source]
|
||||
----
|
||||
spring.ai.ollama.embedding.options.model=hf.co/mixedbread-ai/mxbai-embed-large-v1
|
||||
spring.ai.ollama.init.pull-model-strategy=always
|
||||
----
|
||||
|
||||
- `spring.ai.ollama.embedding.options.model`: Specifies the https://huggingface.co/models?library=gguf&sort=trending[Hugging Face GGUF model] to use.
|
||||
- `spring.ai.ollama.init.pull-model-strategy=always`: (optional) Enables automatic model pulling at startup time.
|
||||
For production, you should pre-download the models to avoid delays: `ollama pull hf.co/mixedbread-ai/mxbai-embed-large-v1`.
|
||||
|
||||
== Sample Controller
|
||||
|
||||
This will create a `EmbeddingModel` implementation that you can inject into your class.
|
||||
|
||||
Reference in New Issue
Block a user