-
-
Notifications
You must be signed in to change notification settings - Fork 241
Use foreign_key instead of to_s for acts_as methods #157
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
Conversation
@@ -24,19 +24,19 @@ def acts_as_chat(message_class: 'Message', tool_call_class: 'ToolCall') | |||
to: :to_llm | |||
end | |||
|
|||
def acts_as_message(chat_class: 'Chat', tool_call_class: 'ToolCall', touch_chat: false) # rubocop:disable Metrics/MethodLength | |||
def acts_as_message(chat_class: 'Chat', tool_call_class: 'ToolCall', **options) # rubocop:disable Metrics/MethodLength |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for whatever it's worth, I didn't do this just to avoid changing the call signature, but +1.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #157 +/- ##
=======================================
Coverage 93.66% 93.66%
=======================================
Files 87 87
Lines 3202 3204 +2
Branches 418 418
=======================================
+ Hits 2999 3001 +2
Misses 203 203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
include MessageMethods | ||
|
||
@chat_class = chat_class.to_s | ||
@chat_foreign_key = "#{@chat_class.underscore}_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also for what it's worth, I think changing the existing code to ActiveSupport::Inflector.foreign_key(@chat_class)
would do what you want.
…ith-image * 'main' of github.com:crmne/ruby_llm: (24 commits) Enhance Rails guide with detailed persistence flow explanation and setup instructions Remove work-in-progress warning from models documentation generation Add validation considerations for Message model and update persistence flow documentation Add note about upcoming OpenAI headers support in v1.3.0 Handle OpenAI organization and project IDs (crmne#162) Refactor acts_as_message and acts_as_tool_call methods to improve parameter handling and default values Remove reasoning section from available models documentation and rake task Remove debug logging for pricing in OpenRouter models Updated models page Fixed pricing parsing for OpenRouter Updated models Add warning about work in progress for Parsera integration in available models documentation Major refactoring of ModelInfo and Parsera API support for listing LLM capabilities and pricing. Fix inflector (crmne#159) Use foreign_key instead of to_s for acts_as methods (crmne#157) Fixes #embed fails when using default embedding model Add support for logging to file via configuration (crmne#148) Updated acts_as_* helpers to use canonical 'rails-style' foreign keys (crmne#151) refactor(media): streamline content formatting methods across providers Fixed Calling `chat.to_llm` keeps appending messages to the message array ...
No description provided.