Skip to content

Leveraging DSPy for AI-driven task understanding and solution generation, the Self-Discover Framework automates problem-solving through reasoning and code generation.

Notifications You must be signed in to change notification settings

jmanhype/dspy-self-discover-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Application with DSPy Integration

This repository contains a FastAPI application designed to solve complex tasks through intelligent reasoning and automated code generation. Leveraging DSPy for deep learning and AI capabilities, alongside the Groq platform for enhanced computational power, this application offers a robust solution for processing natural language task descriptions, executing code, and dynamically generating code solutions.

Features

  • Natural Language Task Solving: Processes tasks described in natural language to generate actionable solutions.
  • Code Execution: Executes arbitrary Python code dynamically through an API endpoint.
  • Automated Code Generation: Generates executable code from structured reasoning about tasks, offering end-to-end automation from description to execution.
  • Integration with DSPy and Groq: Utilizes the DSPy framework for AI and machine learning operations, powered by Groq's computational capabilities.

Installation

Ensure you have Python 3.8+ installed. Clone this repository, then install the required dependencies:

pip install -r requirements.txt

Usage

The application provides several endpoints for interacting with its capabilities:

Solving Tasks with Natural Language Descriptions

curl -X 'POST' \
  'http://0.0.0.0:8008/solve-task/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{ "description": "Explain photosynthesis", "task_type": "science" }'

Executing Arbitrary Code

curl -X 'POST' \
  'http://0.0.0.0:8008/execute-code/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d @payload.json

payload.json should contain your Python code in the format:

{
  "code": "print('Hello, world!')"
}

Generating and Executing Code from Task Descriptions

curl -X 'POST' \
  'http://0.0.0.0:8008/generate-and-execute/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{ "description": "Generate a Python function to add two numbers", "task_type": "programming" }'

Running the Server

Start the FastAPI server using Uvicorn:

uvicorn self_discover_dspy_api:app --host 0.0.0.0 --port 8008 --reload

Contributing

Contributions are welcome! Feel free to submit pull requests or open issues to suggest improvements or add new features.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Leveraging DSPy for AI-driven task understanding and solution generation, the Self-Discover Framework automates problem-solving through reasoning and code generation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages