Add universal LLMContext support to AWSBedrockLLMService.run_inference()

This commit is contained in:
Paul Kompfner
2025-09-09 16:00:32 -04:00
parent fe79de8f27
commit 8ccd220a60
2 changed files with 5 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ from pipecat.processors.aggregators.llm_context import (
class AWSBedrockLLMInvocationParams(TypedDict):
"""Context-based parameters for invoking AWS Bedrock's LLM API."""
system: Optional[str]
system: Optional[List[dict[str, Any]]] # [{"text": "system message"}]
messages: List[dict[str, Any]]
tools: List[dict[str, Any]]
tool_choice: LLMContextToolChoice

View File

@@ -815,14 +815,10 @@ class AWSBedrockLLMService(LLMService):
messages = []
system = []
if isinstance(context, LLMContext):
# Future code will be something like this:
# adapter = self.get_llm_adapter()
# params: AWSBedrockLLMInvocationParams = adapter.get_llm_invocation_params(context)
# messages = params["messages"]
# system = params["system_instruction"] # [{"text": "system message"}]
raise NotImplementedError(
"Universal LLMContext is not yet supported for AWS Bedrock."
)
adapter: AWSBedrockLLMAdapter = self.get_llm_adapter()
params: AWSBedrockLLMInvocationParams = adapter.get_llm_invocation_params(context)
messages = params["messages"]
system = params["system"] # [{"text": "system message"}]
else:
context = AWSBedrockLLMContext.upgrade_to_bedrock(context)
messages = context.messages