Developer's reference
Contents
[
Hide
]
This reference describes how to work with Aspose.LLM for .NET once you have the package installed and a license applied. It focuses on concepts, types, and method semantics.
For end-to-end scenarios, see Use cases. For compact task-oriented snippets, see Quick wins.
Typical flow
- Create an API instance: pick a preset and call
AsposeLLMApi.Create(preset). - Start a chat session: either explicitly with
StartNewChatAsync, or implicitly by callingSendMessageAsync. See Chat sessions. - Send messages:
SendMessageAsyncfor the current session, orSendMessageToSessionAsync(sessionId, ...)for a specific one. - Manage cache: when a session approaches the context limit, call
ForceCacheCleanup(strategy)to trim the KV cache. - Persist state: save and load conversations with
SaveChatSessionandLoadChatSession. - Dispose: release native resources with
Disposeor ausingblock.
Additional capabilities
- Default parameters:
GetDefaultParametersAsync()returns a tuple of the engine’s default inference, context, chat, and sampler parameters. - Default preset:
GetDefaultPreset()returns a freshQwen25Presetas a sensible starting point. - Single instance: only one
AsposeLLMApiinstance per process. Disposing the current instance releases the guard.
Sections
- AsposeLLMApi facade: the single-instance facade class: every method, lifecycle, and exception semantics.
- Presets: preset base class, parameter bags, and override patterns.
- Parameters: detailed reference for each of the eight parameter bags.
- Chat sessions: starting sessions, sending messages, and
ChatMessagestructure. - Session persistence: saving and loading sessions to disk.
- Cache management: five
CacheCleanupStrategymodes and when to apply each. - Multimodal: vision presets, attaching images, chat templates, and debugging.
- Acceleration: CUDA, HIP, Metal, Vulkan, CPU backends.
- Dependency injection:
AddLlamaServicesfor ASP.NET Core and Worker Service hosts. - Extensibility: replace core services via
IModelLoader,IModelFileProvider,IPromptFormatter,IMediaProcessor. - Logging and diagnostics:
ILoggerintegration, debug logs, tagged output. - License: the
Licenseclass API. - API reference: link to the full class-level API reference on reference.aspose.com.
What’s next
- Use cases: full scenarios with runnable code.
- Architecture: what happens behind the scenes when you call
Create.