Using Open Ai Structured Output using Markdown templates to write RFPs
Certainly! Here is a more specific example of what you might include in the .env
, .env.example
, and README files for the script that uses OpenAI's API to generate structured responses from a markdown template.
This file contains sensitive information and should not be committed to version control. It includes your OpenAI API key and any other configuration settings needed for the script to function.
OPENAI_API_KEY=your_openai_api_key_here
This file serves as a template to show other developers what environment variables are required. It should be included in version control.
OPENAI_API_KEY=
Here's a README file tailored to the script described earlier:
# Markdown Template Processor
This script processes markdown templates using OpenAI's Structured Output API to generate structured responses.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Environment Variables](#environment-variables)
- [Contributing](#contributing)
- [License](#license)
## Installation
1. **Clone the Repository**:
```bash
git clone https://github.com/codingshot/rfp-ai-structured/.git
cd rfp-ai-structured
-
Install Dependencies: Ensure you have Python installed. Then, install the required packages:
pip install openai pydantic
-
Set Up Environment Variables:
- Copy the
.env.example
file to.env
:cp .env.example .env
- Fill in the
OPENAI_API_KEY
in the.env
file.
- Copy the
Run the script to process a markdown template:
python markdowntostructured.py
- Markdown Template: Modify the
markdown_template
variable in the script to change the input markdown. - Response: The script will output the structured response according to the defined schema.
The script requires the following environment variables:
OPENAI_API_KEY
: Your OpenAI API key. This is required to authenticate requests to the OpenAI API.
OpenAI's Structured Outputs feature allows developers to ensure that model-generated responses adhere to a predefined JSON schema. This capability enhances the reliability and usability of AI-generated content by guaranteeing that outputs conform to specific structural requirements, addressing common challenges in AI-powered applications.
API Integration: Structured Outputs can be used via the OpenAI API by specifying the response_format parameter with your defined schema. This ensures that the model's output will conform to the schem
https://blog.mlq.ai/structured-outputs-openai/
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License.