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

Feature/prompt blueprint #46

Merged
merged 4 commits into from
Jul 3, 2024
Merged

Feature/prompt blueprint #46

merged 4 commits into from
Jul 3, 2024

Conversation

dockhardman
Copy link
Owner

DataModel Enhancements

Refactoring and Improvements

  • Renamed models_from_openai to model_from_openai in the DataModel class
  • Added verbose parameter to model_from_openai method
  • Implemented display of input and output messages when verbose is True
  • Updated error handling and logging in model_from_openai

OpenAI Client Integration

  • Replaced OpenAI client with GoogleOpenAI client in tests
  • Updated model name to "models/gemini-1.5-flash" in tests

PromptTemplate Enhancements

Functionality Improvements

  • Added prompt_messages method to generate formatted messages
  • Implemented __str__ and __repr__ methods for better object representation
  • Enhanced prompt_placeholders method to include placeholders from messages

New Features

  • Added support for multiple messages in prompt templates
  • Implemented prompt_vars_update and prompt_vars_drop methods for managing prompt variables

Prompt Repository Updates

Data Model Prompt

  • Revised the prompt for data model extraction to be more detailed and structured
  • Added examples and step-by-step instructions for parsing user inputs
  • Updated the response format to include JSON output

Utility Functions

Message Display

  • Enhanced display_messages function to support table formatting
  • Added parameters for customizing table title and width

Testing

  • Updated test cases to reflect changes in DataModel and PromptTemplate classes
  • Added verbose output to model_from_openai tests

- Rename `models_from_openai` to `model_from_openai` in DataModel class
- Update `model_from_openai` method to return a list of models
- Remove redundant `model_from_openai` method implementation
- Enhance prompt template in data_model.py for better clarity and structure
- Update test cases to reflect changes in DataModel class methods
- Improve formatting and readability in test_data_model.py
… display.

- **Added**:
  - `cast` import from `typing`.
  - `table_title` and `table_width` parameters for customizable table display.
  - Initialization of `Table` for formatted message display.
  - Conversion of messages to dictionaries for consistent processing.
  - Conditional logic to add rows to the table and print it using `console`.

- **Modified**:
  - Updated the function to handle empty messages by raising a `ValueError`.
  - Adjusted the message reading loop to include table row addition.
  - Ensured the output string is properly formatted and stripped of extra whitespace.

- **Removed**:
  - Direct `console.print` calls for roles and content, replaced with table row addition.

This update improves the readability and customization of message displays in the `display_messages` function.
- Add verbose option to DataModel.model_from_openai for detailed logging
- Implement display_messages utility for input and output visualization
- Integrate GoogleOpenAI client and Gemini model in tests
- Improve error handling and logging in model generation process
- Refactor imports and code structure for better readability
- Update test cases to use new verbose option and Google AI client
- Make 'prompt' parameter optional in PromptTemplate constructor
- Update __call__ method to return formatted messages
- Add methods for improved functionality and representation:
  - prompt_messages: return raw messages with prompt
  - __str__ and __repr__: provide unique identifier using MD5 hash
- Expand format_messages to better handle message-based prompts
- Remove format method in favor of format_messages
- Update prompt_placeholders to find placeholders in messages
- Add docstrings for improved code documentation
@dockhardman dockhardman merged commit 02b97eb into master Jul 3, 2024
1 check failed
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.

None yet

1 participant