mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
0978b4f5ad
Apply the same fixes to both the strands (Python) and strands-typescript integrations for 1:1 parity: - Lift RunAgentInput.context into the prompt (buildStatePrompt / build_state_prompt) so useAgentContext values (readonly-state-agent-context) and the openGenerativeUI design-skill / sandbox-function context actually reach the model. The adapter does not surface context on its own; this mirrors langgraph's lift-context-into-prompt pattern. - open-gen-ui: prepend an imperative to the visualization design skill (and add a design skill to the advanced cell) so the model calls generateSandboxedUi instead of answering in plain text, and clarify that sandbox functions are iframe->host bridges, not LLM tools. - hitl-in-chat: sharpen the book_call description so it wins scheduling intents over the shared backend schedule_meeting tool (which renders no picker). - Add a roll_dice tool (shared python tools + TS tools) so the tool-rendering catch-all 'Roll a d20' and 'Chain tools' pills work.
14 lines
369 B
Python
14 lines
369 B
Python
"""Dice-rolling tool implementation."""
|
|
|
|
import random
|
|
from typing import Any
|
|
|
|
|
|
def roll_dice_impl(sides: int) -> dict[str, Any]:
|
|
"""Roll a die with the given number of sides.
|
|
|
|
Returns a dict with the requested ``sides`` and the rolled ``result``
|
|
(a random integer in ``[1, sides]``).
|
|
"""
|
|
return {"sides": sides, "result": random.randint(1, sides)}
|