-
Notifications
You must be signed in to change notification settings - Fork 0
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
Open_ai_components #18
Conversation
…might return None
…er than payload to avoid confusion with message payload
…ry_but_keep_depth
…s last user message
…trimming the history
…he first message is never a non-user message.
Please mark whether you used Copilot to assist coding in this PR
|
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.
Looks good!
{ | ||
"name": "history_max_time", | ||
"required": False, | ||
"description": "Maximum time to keep conversation history", |
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.
It would be useful to have the unit here (in seconds).
SonarQube Quality Gate |
* First commit of big refactor * refactor: improve event handling in TestOutputComponent * refactor: handle both Message and Event objects in TestInputComponent * fix: handle both Event and Message objects in TestOutputComponent * feat: add Message import to utils_for_test_files * feat: add send_message method to ComponentBase * fix: wrap message in Event before enqueueing to next component * refactor: move timer_manager creation to SolaceAiConnector and improve error handling * feat: add logging for timer manager stop process * perf: optimize TimerManager to reduce CPU usage * fix: improve shutdown process for timer thread * perf: Remove unnecessary sleep in TimerManager run loop * refactor: remove unused send_message method from ComponentBase * refactor: improve clean exit process and resource cleanup * fix: import log module to resolve undefined name errors * refactor: update aggregate component to handle timeout consistently * refactor: update aggregate component output to return list * refactor: simplify aggregation logic and improve method naming * fix: reset current_aggregation after returning aggregation * All tests now pass * Warning cleanup * chore: one additional small fix to account for input components that might return None * refactor: rename Event class 'payload' to 'data' * refactor: Update get_message_from_flow to use event.data instead of event.payload * Switched the contained data in the Event class to be called data rather than payload to avoid confusion with message payload * Remove commented code * feat: add OpenAI chat model components with and without history * refactor: replace LangChain with native OpenAI library for chat models * feat: add history max time and clear history options to OpenAI chat model * feat: implement clear_history_but_keep_depth functionality * more changes * feat: add method to clear chat history while retaining specified depth * fix: correct data member references in clear_history_but_keep_depth method * refactor: implement thread-safe history storage using KV store * feat: implement history_max_time parameter for message pruning * feat: add time-based history pruning to OpenAIChatModelWithHistory * refactor: optimize history management in OpenAIChatModelWithHistory * feat: implement time-based pruning in conversation history * refactor: optimize chat history management * feat: add history age-out functionality with hourly cleanup timer * clean up some spacing * feat: add base_url configuration for OpenAIChatModelBase * feat: add streaming functionality to OpenAIChatModelBase * feat: update chat history handling for system messages * refactor: ensure first history message is user message in clear_history_but_keep_depth * refactor: update clear_history_but_keep_depth to ensure depth includes last user message * Make sure that the first message in the history has a user role when trimming the history * Merge branch 'main' into open_ai_components * chore: Some small formatting changes * chore: Add some protection around clearing the history to make sure the first message is never a non-user message.
* First commit of big refactor * refactor: improve event handling in TestOutputComponent * refactor: handle both Message and Event objects in TestInputComponent * fix: handle both Event and Message objects in TestOutputComponent * feat: add Message import to utils_for_test_files * feat: add send_message method to ComponentBase * fix: wrap message in Event before enqueueing to next component * refactor: move timer_manager creation to SolaceAiConnector and improve error handling * feat: add logging for timer manager stop process * perf: optimize TimerManager to reduce CPU usage * fix: improve shutdown process for timer thread * perf: Remove unnecessary sleep in TimerManager run loop * refactor: remove unused send_message method from ComponentBase * refactor: improve clean exit process and resource cleanup * fix: import log module to resolve undefined name errors * refactor: update aggregate component to handle timeout consistently * refactor: update aggregate component output to return list * refactor: simplify aggregation logic and improve method naming * fix: reset current_aggregation after returning aggregation * All tests now pass * Warning cleanup * chore: one additional small fix to account for input components that might return None * refactor: rename Event class 'payload' to 'data' * refactor: Update get_message_from_flow to use event.data instead of event.payload * Switched the contained data in the Event class to be called data rather than payload to avoid confusion with message payload * Remove commented code * feat: add OpenAI chat model components with and without history * refactor: replace LangChain with native OpenAI library for chat models * feat: add history max time and clear history options to OpenAI chat model * feat: implement clear_history_but_keep_depth functionality * more changes * feat: add method to clear chat history while retaining specified depth * fix: correct data member references in clear_history_but_keep_depth method * refactor: implement thread-safe history storage using KV store * feat: implement history_max_time parameter for message pruning * feat: add time-based history pruning to OpenAIChatModelWithHistory * refactor: optimize history management in OpenAIChatModelWithHistory * feat: implement time-based pruning in conversation history * refactor: optimize chat history management * feat: add history age-out functionality with hourly cleanup timer * clean up some spacing * feat: add base_url configuration for OpenAIChatModelBase * feat: add streaming functionality to OpenAIChatModelBase * feat: update chat history handling for system messages * refactor: ensure first history message is user message in clear_history_but_keep_depth * refactor: update clear_history_but_keep_depth to ensure depth includes last user message * Make sure that the first message in the history has a user role when trimming the history * Merge branch 'main' into open_ai_components * chore: Some small formatting changes * chore: Add some protection around clearing the history to make sure the first message is never a non-user message.
Added a native OpenAI component which is a bit more efficient than going through LangChain. The history is managed directly in this component
Also improved the history handling a bit in the LangChain history component.