Add universal LLMContext support to AWSBedrockLLMService.run_inference()
This commit is contained in:
@@ -29,7 +29,7 @@ from pipecat.processors.aggregators.llm_context import (
|
|||||||
class AWSBedrockLLMInvocationParams(TypedDict):
|
class AWSBedrockLLMInvocationParams(TypedDict):
|
||||||
"""Context-based parameters for invoking AWS Bedrock's LLM API."""
|
"""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]]
|
messages: List[dict[str, Any]]
|
||||||
tools: List[dict[str, Any]]
|
tools: List[dict[str, Any]]
|
||||||
tool_choice: LLMContextToolChoice
|
tool_choice: LLMContextToolChoice
|
||||||
|
|||||||
@@ -815,14 +815,10 @@ class AWSBedrockLLMService(LLMService):
|
|||||||
messages = []
|
messages = []
|
||||||
system = []
|
system = []
|
||||||
if isinstance(context, LLMContext):
|
if isinstance(context, LLMContext):
|
||||||
# Future code will be something like this:
|
adapter: AWSBedrockLLMAdapter = self.get_llm_adapter()
|
||||||
# adapter = self.get_llm_adapter()
|
params: AWSBedrockLLMInvocationParams = adapter.get_llm_invocation_params(context)
|
||||||
# params: AWSBedrockLLMInvocationParams = adapter.get_llm_invocation_params(context)
|
messages = params["messages"]
|
||||||
# messages = params["messages"]
|
system = params["system"] # [{"text": "system message"}]
|
||||||
# system = params["system_instruction"] # [{"text": "system message"}]
|
|
||||||
raise NotImplementedError(
|
|
||||||
"Universal LLMContext is not yet supported for AWS Bedrock."
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
context = AWSBedrockLLMContext.upgrade_to_bedrock(context)
|
context = AWSBedrockLLMContext.upgrade_to_bedrock(context)
|
||||||
messages = context.messages
|
messages = context.messages
|
||||||
|
|||||||
Reference in New Issue
Block a user