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
질문됨 한 달 전75회 조회
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
전문가
답변함 한 달 전
  • 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?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠