Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ai refactor #61

Merged
merged 40 commits into from
Nov 2, 2023
Merged

Ai refactor #61

merged 40 commits into from
Nov 2, 2023

Conversation

seanmcn
Copy link
Collaborator

@seanmcn seanmcn commented Oct 31, 2023

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Main Changes

  • Replaces tectalic/openai with guzzlehttp/guzzle
  • Moves all functionality related to AI to it's own namespace.
  • Updates console commands for generating README.md & DocBlocks to:
    • Get parameters ai_provider, ai_api_key & ai_model from either configuration or parameters.
    • Request required parameters from the user that are missing.
    • Build the AI provider from ProviderFactory
  • AI Generators updated to build the prompts, only interacting with a provider for:
    • Sending prompts to AI provider
    • Formatting data prompts
    • Getting system prompt
  • AI Provider for OpenAI simplified as well as the ProviderInterface.
  • Removes template & template content generation commands for the moment

Misc Changes

  • Updated CaptainHook to be less concerned about the line length of the body in commit messages
  • Simplified .gitignore to ignore files regardless of demo directory
  • Added roave/security-advisorie to composer.json require-dev

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added/updated tests.

Adds rules to ignore certain directories of all demos
Only look at files in `/src` for demos
- Adds support for using HuggingFace models
- Moves as much configuration as possible to ENV variables
- Moves code related to AI to its own namespace
- Replaces `tectalic/openai` with `guzzlehttp/guzzle`
# Conflicts:
#	.gitignore
#	composer.lock
# Conflicts:
#	docs/tech/classes/MissingDocBlocksGenerator.md
#	docs/tech/classes/ReadmeTemplateFiller.md
#	docs/tech/classes/TemplatesStructureGenerator.md
#	src/DocGenerator.php
These will be re-added in another branch
Refactors the AI provider interface to make
 adding additional AI providers easier
Updated prompt for template generation
Option for template generation to be non-interactive
- Adds new configuration
- Moves demo for template content
- Template generation no longer creates a structure that mirrors the namespaces
- Changes template content generation to only generate content for structures that have been automatically generated
- Renames commands/generators and prompts to better match
- Moves commands over to AI namespace & adds shared parameters/configuration
- Updates generators to allow easy overriding of system prompts
- Adds back support for choosing OpenAI model if one not provided
- Adds non-interactive mode for most commands
# Conflicts:
#	docs/classes/DocGenerator.md
#	docs/shared_c.cache
#	docs/tech/classes/DocGenerator.md
Removing for the moment, will be re-added in a later branch
- Switches to using custom config options
- Has console command build the AI provider for use in functions
- Switches to asking for provider/model/api key if not provided
- Tests API key is valid
# Conflicts:
#	docs/classes/DocGenerator.md
#	docs/shared_c.cache
#	docs/tech/1.configuration/classes/PageLinkerPlugin.md
#	docs/tech/1.configuration/readme.md
#	docs/tech/4.pluginSystem/classes/PageLinkerPlugin.md
#	docs/tech/classes/DocBlocksGenerator.md
#	docs/tech/classes/DocGenerator.md
#	docs/tech/classes/PageLinkerPlugin.md
#	docs/tech/classes/ReadmeTemplateGenerator.md
#	docs/tech/classes/TemplateStructureGenerator.md
@seanmcn seanmcn requested a review from shcherbanich October 31, 2023 18:11
protected function getCustomConfigOptionsMap(): array
{
return [
'project_root' => 'Path to the directory of the documented project',
'templates_dir' => 'Path to directory with documentation templates',
'cache_dir' => 'Configuration parameter: Path to the directory where the documentation generator cache will be saved',
'ai_provider' => 'The AI service to use, options: openai',
'ai_api_key' => 'The API key to use when interacting with the AI',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the key is not required in the provider but other parameters are required? I think that then it’s worth getting the remaining parameters except the provider in the provider factory method

@seanmcn seanmcn merged commit c7258ee into 1.x.x Nov 2, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants