Introduction
We have studied about how ollama can run the Large Language models (LLMs) locally in your computer system. but in real world application user not only communicate with terminal.
suppose you have to make some application like:
- AI chatbot
- Resume Analyzer
- News classifier
- Personal AI Assistant
Then how your Application will communicate with ollama is defined by ollama API.
what is an API?
API stands for Application Programming Interface. API acts as bridge between two software which helps then to communicate with each other.
example:-
Your Application → API → AI Model
Why does ollama provide an API?
The problem which have to faced by the user if no API exist is that to communicate with the model we have to use terminal every time. If you are creating any Website or Application then user will not communicate with the terminal so to resolve this problem ollama provides API services.
example:-
User → website → ollama API → llama 3 → response
so ollama provides API.
How does ollama API works?
when any user enters any prompt like “what is Artificial Intelligence?” then application do not communicate directly with model.
User → Application → ollama API → llama 3 → generated response → application → user
API handles the communication between the user and the model.
ollama API server
when ollama is installed it provides a local server who's default address is:
http://localhost:11434
where, localhost = current computer
11434 = port number
means ollama's API run in your system.
Understanding localhost
Sometimes Beginners get confused by the localhost. localhost is your own computer. when you enter in browser:
http://localhost:11434
then this request not use internet it works in your local system.
Why is ollama API Important?
Without API you can only use terminal for any interaction with the model. But with API you can make multiple applications like Web Applications, Desktop application, chatbots, AI assistants, mobile apps, etc.
read more about ollama:-
previous topic:-
essential ollama commands every beginner should know
next topic:-
using ollama with python