---
title: "OpenAI Function Flex"
url: "https://ridwaanhall.com/projects/openai-function-flex"
markdown: "https://ridwaanhall.com/projects/openai-function-flex.md"
summary: "Calling the OpenAI API with structured requests from Python and Flask."
---

# OpenAI Function Flex

> Calling the OpenAI API with structured requests from Python and Flask.

- Category: AI
- Status: Completed
- Started: October 14, 2023
- Built with: OpenAI API, Flask, Python
- Source: https://github.com/ridwaanhall/Function-Calling-with-the-OpenAI-API

## About

### The problem

Language models are most useful when they can call real functions, but structuring those requests reliably is not obvious at first.

### The approach

I built a Flask project that sends structured requests to GPT-3.5 Turbo with Python's requests library and maps them to purpose-built functions.

- A locationQuery function for weather information.
- An authorQuery function for author information.
- Structured POST requests to the OpenAI API.

### The result

The project demonstrates function-style integration with a language model, a pattern that now underpins tool use in AI applications.

## Features

- **Task Functions**: Built-in functions for weather and author queries.
- **Structured Requests**: Python's requests library for reliable API calls.
- **GPT-3.5 Turbo**: Accurate responses across varied text tasks.

## Tags

OpenAI, GPT-3.5 Turbo, API, NLP, Flask, Python, Function Calling, Text Processing, AI

## Elsewhere

- This page for people: https://ridwaanhall.com/projects/openai-function-flex
- Index of every page as Markdown: [llms.txt](https://ridwaanhall.com/llms.txt)
