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?

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ