Class OllamaProvider
- All Implemented Interfaces:
LLMProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Method Summary
Modifier and TypeMethodDescriptionstatic OllamaProvider.Builderbuilder()chat(LLMRequest request) Send a chat completion request to the LLM.chatStream(LLMRequest request, Consumer<StreamingChunk> chunkHandler) Stream a chat completion request to the LLM.Get the list of available models from this provider.Get the default model for this provider.Get the name of this provider.booleanCheck if this provider supports function calling.booleanCheck if this provider supports streaming responses.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.agenor.core.llm.LLMProvider
validateRequest
-
Method Details
-
chat
Description copied from interface:LLMProviderSend a chat completion request to the LLM.This is the primary method for interacting with the LLM. It sends a request containing messages and configuration, and returns a response asynchronously.
- Specified by:
chatin interfaceLLMProvider- Returns:
- CompletableFuture containing the LLM response
-
chatStream
public CompletableFuture<Void> chatStream(LLMRequest request, Consumer<StreamingChunk> chunkHandler) Description copied from interface:LLMProviderStream a chat completion request to the LLM.Similar to
LLMProvider.chat(LLMRequest), but provides streaming updates as the response is generated. This is useful for long responses where you want to show incremental progress to users.Example usage:
provider.chatStream(request, chunk -> { System.out.print(chunk.content()); }).thenRun(() -> { System.out.println("\nStreaming complete"); });- Specified by:
chatStreamin interfaceLLMProvider- Returns:
- CompletableFuture that completes when streaming is finished
-
getAvailableModels
Description copied from interface:LLMProviderGet the list of available models from this provider.Returns a list of model identifiers that can be used with this provider. Model names are provider-specific (e.g., "gpt-4", "claude-3-opus", "llama2").
- Specified by:
getAvailableModelsin interfaceLLMProvider- Returns:
- CompletableFuture containing list of available model names
-
getProviderName
Description copied from interface:LLMProviderGet the name of this provider.Returns a human-readable identifier for this provider, such as "OpenAI", "Anthropic", or "Ollama".
- Specified by:
getProviderNamein interfaceLLMProvider- Returns:
- the provider name
-
supportsFunctionCalling
public boolean supportsFunctionCalling()Description copied from interface:LLMProviderCheck if this provider supports function calling.Function calling (also known as tool use) allows the LLM to call external functions to gather information or perform actions. Not all providers or models support this feature.
- Specified by:
supportsFunctionCallingin interfaceLLMProvider- Returns:
- true if function calling is supported, false otherwise
-
supportsStreaming
public boolean supportsStreaming()Description copied from interface:LLMProviderCheck if this provider supports streaming responses.Streaming allows incremental delivery of responses as they are generated. Most modern LLM providers support this feature.
- Specified by:
supportsStreamingin interfaceLLMProvider- Returns:
- true if streaming is supported, false otherwise
-
getDefaultModel
Description copied from interface:LLMProviderGet the default model for this provider.Returns a reasonable default model that can be used if the user doesn't specify one. This should be a balanced model that works well for general purposes.
- Specified by:
getDefaultModelin interfaceLLMProvider- Returns:
- the default model name, or null if no default is available
-
builder
-