/rfp-ai-structured

Takes prompt in script. Structures output based on markdown template.

Primary LanguagePythonMIT LicenseMIT

image

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.

.env File

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

.env.example File

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=

README.md

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
  1. Install Dependencies: Ensure you have Python installed. Then, install the required packages:

    pip install openai pydantic
  2. 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.

Usage

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.

Environment Variables

The script requires the following environment variables:

  • OPENAI_API_KEY: Your OpenAI API key. This is required to authenticate requests to the OpenAI API.

About Open AI Structured Outputs

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/

Contributing

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a pull request.

License

This project is licensed under the MIT License.