invokeAgent through laravel returns empty array with no data but Http status code is 200

0

Request:

$result = $this->bedrockAgentRuntimeClient->invokeAgent([ 'agentAliasId' => '7KE1CTD7K9', 'agentId' => '1J7WQD0M4G', 'sessionId' => 'abc', 'inputText' => 'which country won soccer in 2023?' ]); return $result;

Response: Model Data

Data can be retrieved from the model object using the get() method of the model (e.g., $result->get($key)) or "accessing the result like an associative array (e.g. $result['key']). You can also execute JMESPath expressions on the result data using the search() method.

{ "completion": {}, "contentType": "application/json", "sessionId": "abc", "@metadata": { "statusCode": 200, "effectiveUri": "https://bedrock-agent-runtime.us-east-1.amazonaws.com/agents/1J7WQD0M4G/agentAliases/7KE1CTD7K9/sessions/abc/text", "headers": { "date": "Wed, 17 Apr 2024 13:55:56 GMT", "content-type": "application/json", "transfer-encoding": "chunked", "connection": "keep-alive", "x-amzn-requestid": "88d1e728-129d-49fc-9f4b-380bd85f3995", "x-amz-bedrock-agent-session-id": "abc", "x-amzn-bedrock-agent-content-type": "application/json" }, "transferStats": { "http": [ [] ] } } }

Guru
已提问 1 个月前79 查看次数
1 回答
0

Hello Guru,

I apologize for the delayed response. I have reviewed your issue, and it seems unusual that the response is empty, as the syntax appears to be correct.

Could you please try setting enableTrace to true in your invokeAgent call? This will allow you to track the agent's reasoning process and better understand why the response is empty.

$result = $client->invokeAgent([
    'agentAliasId' => '7KE1CTD7K9',
    'agentId' => '1J7WQD0M4G',
    'enableTrace' => true,
    'inputText' => 'which country won soccer in 2023?',
    'sessionId' => 'abc'
]);

🍀 It seems likely that there's a problem with the setup or content of the agent's configuration or knowledge base.


Key Source:
profile picture
专家
已回答 1 个月前
  • Thank you Osvaldo. I'll give it a try..

  • After you try it, please can you share the trace, to see why this is coming empty?

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则