cognitect-labs / aws-api

AWS, data driven
Apache License 2.0
731 stars 100 forks source link

An issue with bedrock-agent-runtime and InvokeAgent in AWS Bedrock #259

Open akaromka opened 1 week ago

akaromka commented 1 week ago

Dependencies

 [com.cognitect.aws/api "0.8.692"]
 [com.cognitect.aws/endpoints "1.1.12.772"]
 [com.cognitect.aws/bedrock-agent-runtime "869.2.1687.0"]

Description with failing test case

I am trying to InvokeAgent using the following code:

(def bedrock-client (aws/client {:api :bedrock-agent-runtime}))
(let [request {:agentId "QWERTY"
                 :agentAliasId "QWERTY"
                 :sessionId "123456789"
                 :inputText prompt}
        response (aws/invoke bedrock-client
                             {:op :InvokeAgent
                              :request request})]
    response)

Stack traces

{:cognitect.anomalies/category :cognitect.anomalies/fault, :cognitect.aws.client.impl/throwable #error {
 :cause No matching clause: 0
 :via
 [{:type java.lang.IllegalArgumentException
   :message No matching clause: 0
   :at [clojure.data.json$next_token invokeStatic json.clj 321]}]
 :trace
 [[clojure.data.json$next_token invokeStatic json.clj 321]
  [clojure.data.json$next_token invoke json.clj 317]
  [clojure.data.json$_read invokeStatic json.clj 406]
  [clojure.data.json$_read invoke json.clj 404]
  [clojure.data.json$_read1 invokeStatic json.clj 453]
  [clojure.data.json$_read1 invoke json.clj 451]
  [clojure.data.json$read_str invokeStatic json.clj 547]
  [clojure.data.json$read_str doInvoke json.clj 539]
  [clojure.lang.RestFn invoke RestFn.java 442]
  [cognitect.aws.shape$json_parse invokeStatic shape.clj 152]
  [cognitect.aws.shape$json_parse invoke shape.clj 149]
  [cognitect.aws.protocols.rest$parse_body invokeStatic rest.clj 252]
  [cognitect.aws.protocols.rest$parse_body invoke rest.clj 244]
  [cognitect.aws.protocols.rest$parse_http_response invokeStatic rest.clj 265]
  [cognitect.aws.protocols.rest$parse_http_response invoke rest.clj 258]
  [cognitect.aws.protocols.rest_json$eval22166$fn__22167 invoke rest_json.clj 41]
  [clojure.lang.MultiFn invoke MultiFn.java 239]
  [cognitect.aws.client.impl$handle_http_response invokeStatic impl.clj 30]
  [cognitect.aws.client.impl$handle_http_response invoke impl.clj 24]
  [cognitect.aws.client.impl$send_request$fn__21527$state_machine__10049__auto____21556$fn__21559 invoke impl.clj 87]
  [cognitect.aws.client.impl$send_request$fn__21527$state_machine__10049__auto____21556 invoke impl.clj 83]
  [clojure.core.async.impl.ioc_macros$run_state_machine invokeStatic ioc_macros.clj 972]
  [clojure.core.async.impl.ioc_macros$run_state_machine invoke ioc_macros.clj 971]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invokeStatic ioc_macros.clj 976]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invoke ioc_macros.clj 974]
  [clojure.core.async.impl.ioc_macros$take_BANG_$fn__10067 invoke ioc_macros.clj 985]
  [clojure.core.async.impl.channels.ManyToManyChannel$fn__4790$fn__4791 invoke channels.clj 100]
  [clojure.lang.AFn run AFn.java 22]
  [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1144]
  [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 642]
  [clojure.core.async.impl.concurrent$counted_thread_factory$reify__4659$fn__4660 invoke concurrent.clj 29]
  [clojure.lang.AFn run AFn.java 22]
  [java.lang.Thread run Thread.java 1570]]}}