本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
查看关于代理的信息
创建代理后,您可以根据需要查看或更新其配置。配置适用于工作草稿。如果您不再需要某个代理,可以将其删除。
要了解如何查看有关代理的信息,请选择首选方法的选项卡,然后按照以下步骤操作:
- Console
-
查看关于代理的信息
-
AWS Management Console 使用具有 Amazon Bedrock 权限的 IAM 角色登录,然后通过以下网址打开 Amazon Bedrock 控制台。https://console.aws.amazon.com/bedrock/
-
从左侧导航窗格中选择代理。然后,在代理部分选择一个代理。
-
在代理详细信息页面上,您可以看到适用于所有版本的代理的配置、关联的标签及其版本和别名。
-
要查看关于代理的工作草稿的详细信息,请选择在代理生成器中编辑。
-
- API
-
要获取有关代理的信息,请使用适用于 Amazon Bedrock 的代理构建时终端节点发送GetAgent请求并指定。
agentId
def get_agent(self, agent_id, log_error=True): """ Gets information about an agent. :param agent_id: The unique identifier of the agent. :param log_error: Whether to log any errors that occur when getting the agent. If True, errors will be logged to the logger. If False, errors will still be raised, but not logged. :return: The information about the requested agent. """ try: response = self.client.get_agent(agentId=agent_id) agent = response["agent"] except ClientError as e: if log_error: logger.error(f"Couldn't get agent {agent_id}. {e}") raise else: return agent
有关更多信息,请参阅 开始使用 Amazon Bedrock 代理。
要列出有关您的代理的信息,请使用适用于 Amazon Bedrock 的代理构建时终端节点发送ListAgents请求。参阅代码示例。您可以指定以下可选参数:
字段 简短描述 maxResults 要在响应中返回的结果数量上限。 nextToken 如果结果的数量多于您在 maxResults
字段中指定的数量,响应会返回一个nextToken
值。要查看下一批结果,请在另一个请求中发送nextToken
值。要列出代理的所有标签,请使用适用于 Amazon Bedrock 的代理构建时终端节点发送ListTagsForResource请求,并附上代理的亚马逊资源名称 (ARN)。
def list_agents(self): """ List the available Amazon Bedrock Agents. :return: The list of available bedrock agents. """ try: all_agents = [] paginator = self.client.get_paginator("list_agents") for page in paginator.paginate(PaginationConfig={"PageSize": 10}): all_agents.extend(page["agentSummaries"]) except ClientError as e: logger.error(f"Couldn't list agents. {e}") raise else: return all_agents
有关更多信息,请参阅 开始使用 Amazon Bedrock 代理。
创建代理的先决条件
修改代理