File tree Expand file tree Collapse file tree 3 files changed +15
-17
lines changed Expand file tree Collapse file tree 3 files changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -45,9 +45,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4545 # or
4646 context: OpenAILLMContext
4747
48- # Reading messages from context
49- messages = context.messages
50-
5148 # # AFTER:
5249
5350 # Context aggregator type
@@ -58,9 +55,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5855
5956 # Context type
6057 context: LLMContext
61-
62- # Reading messages from context
63- messages = context.get_messages()
6458 ```
6559
6660- Added support for ` bulbul:v3 ` model in ` SarvamTTSService ` and
Original file line number Diff line number Diff line change @@ -106,14 +106,28 @@ def __init__(
106106 self ._tools : ToolsSchema | NotGiven = LLMContext ._normalize_and_validate_tools (tools )
107107 self ._tool_choice : LLMContextToolChoice | NotGiven = tool_choice
108108
109+ @property
110+ def messages (self ) -> List [LLMContextMessage ]:
111+ """Get the current messages list.
112+
113+ NOTE: This is equivalent to calling `get_messages()` with no filter. If
114+ you want to filter out LLM-specific messages that don't pertain to your
115+ LLM, use `get_messages()` directly.
116+
117+ Returns:
118+ List of conversation messages.
119+ """
120+ return self .get_messages ()
121+
109122 def get_messages (self , llm_specific_filter : Optional [str ] = None ) -> List [LLMContextMessage ]:
110123 """Get the current messages list.
111124
112125 Args:
113126 llm_specific_filter: Optional filter to return LLM-specific
114127 messages for the given LLM, in addition to the standard
115128 messages. If messages end up being filtered, an error will be
116- logged.
129+ logged; this is intended to catch accidental use of
130+ incompatible LLM-specific messages.
117131
118132 Returns:
119133 List of conversation messages.
Original file line number Diff line number Diff line change 2727 context: AWSNovaSonicLLMContext
2828 # or
2929 context: OpenAILLMContext
30-
31- # Reading messages from context
32- messages = context.messages
3330 ```
3431
3532 AFTER:
4340
4441 # Context type
4542 context: LLMContext
46-
47- # Reading messages from context
48- messages = context.get_messages()
4943 ```
5044"""
5145
7064 "context: AWSNovaSonicLLMContext\n "
7165 "# or\n "
7266 "context: OpenAILLMContext\n \n "
73- "# Reading messages from context\n "
74- "messages = context.messages\n "
7567 "```\n \n "
7668 "AFTER:\n "
7769 "```\n "
8274 "frame: LLMContextFrame\n \n "
8375 "# Context type\n "
8476 "context: LLMContext\n \n "
85- "# Reading messages from context\n "
86- "messages = context.messages\n "
8777 "```" ,
8878 DeprecationWarning ,
8979 stacklevel = 2 ,
You can’t perform that action at this time.
0 commit comments