Skip to content

Commit b09bc2f

Browse files
committed
Fixed a bug in window update
1 parent 3cbb8c3 commit b09bc2f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

amadeusgpt/agentic/video_llm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def speak(self, video_data):
137137
self.update_history("system", self.system_prompt)
138138
self.update_history(
139139
"user", "This video is about a mouse in its home cage.", multi_image_content=multi_image_content, in_place = True)
140-
140+
141141
response = self.connect_gpt(self.context_window)
142142
text = response.choices[0].message.content.strip()
143143
print(text)
@@ -153,7 +153,6 @@ def speak(self, video_data):
153153
video_sampler = VideoSampler(video_path, segment_duration, frames_per_segment)
154154
video_data = video_sampler.process_video()
155155

156-
video_data = {k:v for k,v in video_data.items() if k < 1}
157-
print (video_data)
156+
video_data = {k:v for k,v in video_data.items() if k < 30}
158157
video_llm = VideoLLM(config=config)
159158
video_llm.speak(video_data)

amadeusgpt/analysis_objects/llm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class LLM(AnalysisObject):
2020

2121
def __init__(self, config):
2222
self.config = config
23-
self.max_tokens = config.get("max_tokens", 36000)
23+
self.max_tokens = config.get("max_tokens", 4096)
2424
self.gpt_model = config.get("gpt_model", "gpt-4o")
2525
self.keep_last_n_messages = config.get("keep_last_n_messages", 2)
2626

@@ -168,11 +168,13 @@ def update_history(self, role, content, multi_image_content = None, in_place=Fal
168168
self.context_window.pop(1)
169169

170170
if in_place == True:
171-
assert len(self.context_window) <= 2, "context window should have only 2 elements"
171+
assert len(self.context_window) <= 2, "context window should have no more than 2 elements"
172172
if len(self.context_window) == 2:
173173
self.context_window[1] = new_message
174174
else:
175175
self.context_window.append(new_message)
176+
else:
177+
self.context_window.append(new_message)
176178

177179

178180
def clean_context_window(self):

0 commit comments

Comments
 (0)