Skip to main content

A package for generating code using various AI models.

Project description

PilotHub

Pilot Aggregator is a Python package designed to streamline the aggregation of data from multiple sources. Built with efficiency and flexibility in mind, this package allows developers to easily collect, process, and manage data in a unified manner.

Features

  • Unified API Configuration: Easily configure API keys for different LLMs.
  • LLM Integration: Seamlessly switch between different LLMs (e.g., OpenAI, Gemini, Mistral) for text and code generation.
  • Code Generation: Generate Python code based on prompts using the specified LLM.
  • Text Generation: Generate detailed text responses based on prompts using the specified LLM.
  • Extensible Design: Easily add support for more LLMs in the future.

Installation

You can install the package using pip:

pip install pilot-fusion

Getting Started

1. Configure API Keys

Before using the LLMs, you need to set the API keys. The package provides utility functions in config.py to set and retrieve these keys.

Example:

from pilot_fusion.config import set_openai_api_key, set_google_api_key, set_mistral_api_key

# Set the OpenAI API key
set_openai_api_key('your-openai-api-key')

# Set the Google API key for Gemini
set_google_api_key('your-google-api-key')

# Set the Mistral API key
set_mistral_api_key('your-mistral-api-key')

2. Using LLMs for Code Generation

You can generate code using different LLMs by creating an instance of the corresponding generator class.

from pilot_fusion.gemini_integration import GeminiCodeGenerator

# Initialize the Gemini code generator
gemini_generator = GeminiCodeGenerator()

# Generate code based on a prompt
prompt = "Create a diagram for a microservices architecture."
code = gemini_generator.generate_code(prompt)

print(code)

3. Using LLMs for Text Generation

Similar to code generation, you can also generate text responses using different LLMs.

Example:

# Generate a text response based on a prompt
text = gemini_generator.generate_text("Explain the benefits of using microservices.")

print(text)

Adding Support for New LLMs

The package is designed to be extensible. To add a new LLM:

  1. Create a new class that inherits from CodeGenerator.
  2. Implement the get_model_response method to interact with the new LLM's API.
  3. Add configuration functions for the new LLM's API key in config.py.

Example Skeleton for Adding a New LLM

from pilot_fusion.commonllm import CodeGenerator
from pilot_fusion.config import get_newllm_api_key
import newllm

class NewLLMCodeGenerator(CodeGenerator):
    def __init__(self):
        super().__init__('newllm')
        self.configure_api_key()

    def configure_api_key(self):
        api_key = get_newllm_api_key()
        newllm.configure(api_key=api_key)

    def get_model_response(self, full_prompt: str):
        model = newllm.GenerativeModel('newllm-model')
        response = model.generate_content(full_prompt)
        return {"text": response.text.strip()}

Code Generators Using Different AI Models

1. Gemini Code Generator

This generator uses Google's Gemini model.

from pilot_fusion.gemini_integration import GeminiCodeGenerator

generator = GeminiCodeGenerator(model_name="gemini-1.5-pro")
code = generator.generate_diagram("Create a system diagram for a web application using React, Node.js, and MongoDB.")
print(code)

2. OpenAI Code Generator

This generator uses OpenAI's models like GPT-3.5-turbo.

from pilot_fusion.openai_integration import OpenaiCodeGenerator

generator = OpenaiCodeGenerator(model_name="gpt-3.5-turbo")
code = generator.generate_code("Create a Python function that sorts a list of numbers.")
print(code)

3. Mistral Code Generator

This generator uses the Mistral model.

from pilot_fusion.mistral_integration import MistralCodeGenerator

generator = MistralCodeGenerator(model_name="codestral-mamba-latest")
code = generator.generate_diagram("Create a flowchart for an e-commerce application.")
print(code)

4. Claude Code Generator

This generator uses Anthropic's Claude model.

from pilot_fusion.claude_integration import ClaudeCodeGenerator

generator = ClaudeCodeGenerator(model_name="claude-3-5-sonnet-20240620")
code = generator.generate_diagram("Generate a UML diagram for a microservices architecture.")
print(code)

Contribution

Contributions are welcome! Please fork the repository and create a pull request with your changes.

License

This project is licensed under the MIT License.

Contact

If you have any questions, feel free to open an issue or contact the repository maintainers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pilot_fusion-0.0.3.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

pilot_fusion-0.0.3-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file pilot_fusion-0.0.3.tar.gz.

File metadata

  • Download URL: pilot_fusion-0.0.3.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pilot_fusion-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0f47c6b824abdddebaac820ab9a5bd0e3608b31c556dac60990c750bfdae42b7
MD5 508df3bf0085eb523e82880ba345ff94
BLAKE2b-256 9d29a4d4fa31bfd5c897547acd51bef24d4e4c60929dc0eed3501edca20f3ec2

See more details on using hashes here.

File details

Details for the file pilot_fusion-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pilot_fusion-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pilot_fusion-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee10cb620597b80ba4d52903e9bc999caa32ac350e0ec4e220707a35339a5972
MD5 980df168d361df44d06fbec838bdaaa9
BLAKE2b-256 6edbfd58ba59ab454aebdfcc3e95210b92542242653488242d00c965dcd6332c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page