Ollama

The Ollama component is an AI component that allows users to connect the AI models served with the Ollama library. It can carry out the following tasks:

#Release Stage

Alpha

#Configuration

The component definition and tasks are defined in the definition.json and tasks.json files respectively.

#Setup

In order to communicate with Ollama, the following connection details need to be provided. You may specify them directly in a pipeline recipe as key-value pairs within the component's setup block, or you can create a Connection from the Integration Settings page and reference the whole setup as setup: ${connection.<my-connection-id>}.

FieldField IDTypeNote
Endpoint (required)endpointstringFill in your Ollama hosting endpoint. ### WARNING ###: As of 2024-07-26, the Ollama component does not support authentication methods. To prevent unauthorized access to your Ollama serving resources, please implement additional security measures such as IP whitelisting.
Model Auto-Pull (required)auto-pullbooleanAutomatically pull the requested models from the Ollama server if the model is not found in the local cache.

#Supported Tasks

#Text Generation Chat

Open-source large language models (OSS LLMs) are artificial intelligence models with publicly accessible code and architecture, allowing for free use, modification, and distribution. These models can provide performance comparable to proprietary alternatives. Ollama is a tool that enables you to run and interact with OSS LLMs using limited computational resources. You can install Ollama from: here.

InputIDTypeDescription
Task ID (required)taskstringTASK_TEXT_GENERATION_CHAT
Model Name (required)modelstringThe OSS model to be used, check here for list of models available.
Prompt (required)promptstringThe prompt text.
System Messagesystem-messagestringThe system message helps set the behavior of the assistant. For example, you can modify the personality of the assistant or provide specific instructions about how it should behave throughout the conversation. By default, the modelโ€™s behavior is set using a generic message as "You are a helpful assistant.".
Prompt Imagesprompt-imagesarray[string]The prompt images.
Chat Historychat-historyarray[object]Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: : {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.
SeedseedintegerThe seed.
TemperaturetemperaturenumberThe temperature for sampling.
Top Ktop-kintegerTop k for sampling.
Max New Tokensmax-new-tokensintegerThe maximum number of tokens for model to generate.
Input Objects in Text Generation Chat

Chat History

Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: : {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.

FieldField IDTypeNote
ContentcontentarrayThe message content.
RolerolestringThe message role, i.e. 'system', 'user' or 'assistant'.

Content

The message content.

FieldField IDTypeNote
Image URLimage-urlobjectThe image URL.
TexttextstringThe text content.
TypetypestringThe type of the content part.
Enum values
  • text
  • image_url

Image URL

The image URL.

FieldField IDTypeNote
URLurlstringEither a URL of the image or the base64 encoded image data.
OutputIDTypeDescription
TexttextstringModel Output.

#Local Ollama Instance

To set up an Ollama instance on your local machine, follow the instructions below:

Note: These instructions only work for Instill Core CE

  1. Follow the tutorial on the official GitHub repository to install Ollama on your machine.
  2. Follow the instructions in the FAQ section to modify the variable OLLAMA_HOST to 0.0.0.0, then restart Ollama.
  3. Get the IP address of your machine on the local network.
    • On Linux and macOS, open the terminal and type ifconfig.
    • On Windows, open the command prompt and type ipconfig.
  4. Suppose the IP address is 192.168.178.88, then the Ollama hosting endpoint would be 192.168.178.88:11434.
  5. Enjoy fast LLM inference on your local machine and integration with ๐Ÿ’ง Instill VDP.

#Text Embeddings

An embedding is a list of floating point numbers that captures semantic information about the text that it represents.

InputIDTypeDescription
Task ID (required)taskstringTASK_TEXT_EMBEDDINGS
Model Name (required)modelstringThe OSS model to be used, check here for list of models available.
Text (required)textstringThe text.
OutputIDTypeDescription
Embeddingembeddingarray[number]Embedding of the input text.