aws

2025-07-03T08:25:09.838169Z

anybody having trouble with using bedrock converse api with tools? I'm facing one and clueless

onetom 2025-07-06T05:35:15.554859Z

according to this note: https://github.com/halllo/DotnetAgentExperiments/?tab=readme-ov-file#awssdkbedrockruntime and the corresponding git diff: https://github.com/halllo/DotnetAgentExperiments/commit/81a7257d781227d9e1d18b77c70fe367522ffef0 and their https://stackoverflow.com/questions/79397902/function-calling-with-claude-on-amazon-bedrock-in-net-core the type, properties and required fields shouldn't start with capital letters, but that is not the case in your example either. the only thing which looks like a suspect is that kebab-cased customer-id json key name. while it is completely valid in json to have arbitrary strings in keys, an implementation might be overly strict, so i would try the call with customerId, just to see, if this validation error goes away.

👀 1
2025-07-03T08:26:12.443339Z

{:message "The value at toolConfig.tools.0.toolSpec.inputSchema.json.type must be one of the following: object.",
 :cognitect.aws.http/status 400,
 :cognitect.anomalies/category :cognitect.anomalies/incorrect,
 :cognitect.aws.error/code "ValidationException"}

2025-07-03T08:27:10.721059Z

(aws/invoke @bedrock-runtime-client {:op :Converse :request {:modelId "apac.anthropic.claude-sonnet-4" :messages [{:role "user" :content [{:text "how many cars are there?"}]}] :toolConfig {:tools [{:toolSpec {:name "get-user-cars" :description "Get all devices for a customer." :inputSchema {:json {:type "object" :properties {:customer-id {:type "string"}} :required ["customer-id"]}}}}]} :inferenceConfig {:maxTokens 512 :temperature 0.5 :topP 0.9}}})

2025-07-03T08:30:25.851869Z

• changing "object" to :object ,"Object", "object." didn't work. • writing the value of :json key to json/write-str didn't work. and many other combinations all fail. perhaps the problem is not with the validation? for the spec of the parameter, https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use-inference-call.html is quite straightforward.

2025-07-03T08:47:33.257139Z

;  :toolConfig
;  {:tools
;   [:seq-of
;    {:toolSpec
;     {:name string, :description string, :inputSchema {:json document}},
;     :cachePoint {:type [:one-of ["default"]]}}],
from aws/docs

2025-07-03T09:14:09.983809Z

no matter what I put, the value of :json key is always an empty map.

2025-07-07T09:38:19.847949Z

still doesn't work 😾

{:message "The value at toolConfig.tools.0.toolSpec.inputSchema.json.type must be one of the following: object.",
 :cognitect.aws.http/status 400,
 :cognitect.anomalies/category :cognitect.anomalies/incorrect,
 :cognitect.aws.error/code "ValidationException"}

2025-07-08T00:51:22.446899Z

does anyone know whom I should reach out for?

2025-07-08T00:58:00.592179Z

filed an issue here https://github.com/cognitect-labs/aws-api/issues/272

onetom 2025-07-08T03:37:59.916759Z

that's a good start. the error message is coming back from the aws http api though, so what i would try to do is to check what is the raw http request sent to their api, because that's probably the one, which is deformed somehow. to get a hold on the raw request, i would 1. read the docs, to see if there is a documented way to do so 2. read the source, to see, which function should i redefine to capture the raw request 3. i vaguely remember there was an option to pass in some custom http clients to the various aws service clients, so i would wrap the default client with some instrumentation which captures the request before sending it out

2025-07-08T03:52:42.660729Z

yea I did that already. The request had am empty map {} where there should be the value of :json key. Do you know where I can view the source code? from what I know cognitect uploads libraries directly

onetom 2025-07-08T04:47:30.325149Z

u should share in that ticket how were you looking into the request, since that's an important step in reproducing the issue. re: source code it's in the service-specific jar files. i don't think it's published elsewhere in any different format. they i generated automatically, iirc, but i don't know how to generate them from scratch, locally. so just look inside files like ~/.m2/repository/com/cognitect/aws/s3/871.2.30.22/s3-871.2.30.22.jar

onetom 2025-07-08T04:53:09.126479Z

on intellij, with cursive, u can see these under the External Libraries branch of the project tree tool window. but cider or clojure-mode in emacs also support browsing jar files, just simply navigate into the cognitect.aws.s3.specs ns, for example, with cider-find-var (`M-.`), assuming u have loaded it already.

🙌 1
2025-07-08T05:48:28.680319Z

seems like my case is https://github.com/cognitect-labs/aws-api/issues/270.

👍 2