https://github.com/srbhr/ollama-function-calling
Ollama Function Calling with Search API
https://github.com/srbhr/ollama-function-calling
Last synced: 6 months ago
JSON representation
Ollama Function Calling with Search API
- Host: GitHub
- URL: https://github.com/srbhr/ollama-function-calling
- Owner: srbhr
- Created: 2025-01-29T20:10:09.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-01-29T20:28:35.000Z (11 months ago)
- Last Synced: 2025-01-29T21:25:28.154Z (11 months ago)
- Language: Python
- Size: 15.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Function Calling with Ollama and Web Search

A smart search assistant that combines Ollama's LLM capabilities with web search functionality using function calling. The assistant can decide when to search the web for additional information to answer questions accurately.
**Read the article for more details**: [Tool use and function calling in LLMs](https://www.apideck.com/blog/llm-tool-use-and-function-calling)
## Watch it in Action

## Features
- Function calling with Ollama
- Web search integration via SearchAPI
- Smart decision-making on when to use web search
- Automatic summarization of search results
## Setup
1. Install dependencies:
```bash
pip install ollama python-dotenv requests
```
2. Create `.env` file in project root:
```
SEARCH_API_KEY=your_api_key_here
```
3. Ensure Ollama is running locally
## Project Structure
```
.
├── .env
├── search_tool.py # Search functionality and utilities
└── main.py # Main application logic
```
## Usage
Run the assistant:
```bash
python main.py
```
Example interaction:
```
What would you like to know? What's the latest research on quantum computing?
Processing your question...
Searching the web...
Answer: [Ollama's response with current information]
```
## Requirements
- Python 3.12+
- Ollama installed and running
- SearchAPI key (get from searchapi.io)