Skip to content

Commit f7a41fb

Browse files
Tomas2Djezekra1xjackatomkis
authored
feat: update beeai-framework, add streaming (#1313)
* feat: update beeai-framework, add streaming Signed-off-by: Tomas Dvorak <[email protected]> * fixup! feat: update beeai-framework, add streaming Signed-off-by: Radek Ježek <[email protected]> * fixup! fixup! feat: update beeai-framework, add streaming Signed-off-by: Lukáš Janeček <[email protected]> * chore: upgrade framework Signed-off-by: Tomas Weiss <[email protected]> * chore: upgrading fw versions Signed-off-by: Tomas Weiss <[email protected]> --------- Signed-off-by: Tomas Dvorak <[email protected]> Signed-off-by: Radek Ježek <[email protected]> Signed-off-by: Lukáš Janeček <[email protected]> Signed-off-by: Tomas Weiss <[email protected]> Co-authored-by: Radek Ježek <[email protected]> Co-authored-by: Lukáš Janeček <[email protected]> Co-authored-by: Tomas Weiss <[email protected]>
1 parent 6ce864e commit f7a41fb

File tree

14 files changed

+75
-66
lines changed

14 files changed

+75
-66
lines changed

agents/chat/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ authors = [
77
]
88
requires-python = ">=3.13,<3.14"
99
dependencies = [
10-
"beeai-framework[duckduckgo,wikipedia,beeai-platform]>=0.1.50",
10+
"beeai-framework[beeai-platform,duckduckgo,wikipedia]>=0.1.56",
1111
"openai>=1.107.1",
1212
"beeai-sdk",
13-
"openinference-instrumentation-beeai>=0.1.11",
13+
"openinference-instrumentation-beeai>=0.1.12",
1414
"pydantic-settings>=2.9.0",
1515
"uvicorn>=0.35.0",
1616
]

agents/chat/src/chat/agent.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@
1010
Message,
1111
)
1212
from beeai_framework.adapters.beeai_platform.backend.chat import BeeAIPlatformChatModel
13-
from beeai_framework.agents.experimental import RequirementAgent
14-
from beeai_framework.agents.experimental.events import RequirementAgentSuccessEvent
15-
from beeai_framework.agents.experimental.utils._tool import FinalAnswerTool
13+
from beeai_framework.agents.requirement import RequirementAgent
14+
from beeai_framework.agents.requirement.events import (
15+
RequirementAgentSuccessEvent,
16+
RequirementAgentFinalAnswerEvent,
17+
)
18+
from beeai_framework.agents.requirement.utils._tool import FinalAnswerTool
1619
from beeai_framework.emitter import EventMeta
1720
from beeai_framework.memory import UnconstrainedMemory
1821
from beeai_framework.middleware.trajectory import GlobalTrajectoryMiddleware
1922
from beeai_framework.tools import Tool
2023
from beeai_framework.tools.search.duckduckgo import DuckDuckGoSearchTool
2124
from beeai_framework.tools.search.wikipedia import WikipediaTool
2225
from beeai_framework.tools.weather import OpenMeteoTool
26+
from beeai_framework.backend import ChatModelParameters
2327
from beeai_sdk.a2a.extensions import (
2428
AgentDetail,
2529
AgentDetailContributor,
@@ -214,7 +218,8 @@ async def chat(
214218
ActAlwaysFirstRequirement(), # Enforces the ActTool to be used before any other tool execution.
215219
]
216220

217-
llm = BeeAIPlatformChatModel()
221+
use_streaming = True
222+
llm = BeeAIPlatformChatModel(parameters=ChatModelParameters(stream=use_streaming))
218223
llm.set_context(llm_ext)
219224

220225
# Build dynamic instructions based on available files
@@ -288,6 +293,9 @@ async def chat(
288293
new_messages = [to_framework_message(item, extracted_files) for item in history]
289294

290295
async for event, meta in agent.run(new_messages):
296+
if isinstance(event, RequirementAgentFinalAnswerEvent) and use_streaming:
297+
yield event.delta
298+
291299
if not isinstance(event, RequirementAgentSuccessEvent):
292300
continue
293301

@@ -325,7 +333,8 @@ async def chat(
325333
text=clean_text,
326334
metadata=(citation.citation_metadata(citations=citations) if citations else None),
327335
)
328-
yield message
336+
if not use_streaming:
337+
yield message
329338
await context.store(message)
330339

331340

agents/chat/uv.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agents/form/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ authors = [
77
]
88
requires-python = ">=3.13,<3.14"
99
dependencies = [
10-
"beeai-framework[duckduckgo,wikipedia]>=0.1.50",
10+
"beeai-framework[duckduckgo,wikipedia]>=0.1.56",
1111
"openai==1.99.9",
1212
"beeai-sdk",
13-
"openinference-instrumentation-beeai>=0.1.11",
13+
"openinference-instrumentation-beeai>=0.1.12",
1414
"pydantic-settings>=2.9.0",
1515
"uvicorn>=0.35.0",
1616
]

agents/form/uv.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agents/rag/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ authors = [
77
]
88
requires-python = ">=3.13,<3.14"
99
dependencies = [
10-
"beeai-framework[duckduckgo,wikipedia]>=0.1.50",
10+
"beeai-framework[duckduckgo,wikipedia]>=0.1.56",
1111
"beeai-sdk",
1212
"openai>=1.107.1",
13-
"openinference-instrumentation-beeai>=0.1.11",
13+
"openinference-instrumentation-beeai>=0.1.12",
1414
"pydantic-settings>=2.9.0",
1515
"tenacity>=9.1.2",
1616
"langchain-text-splitters>=0.3.0",

0 commit comments

Comments
 (0)