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
preguntada hace un mes75 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace un mes
  • 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?

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas