Commit 56fe839

mo khan <mo@mokhan.ca>
2025-10-08 19:28:20
docs: add error handling section to README tag: v0.3.0
1 parent a6a59c6
Changed files (1)
README.md
@@ -171,6 +171,22 @@ tools = [
 response = client.messages(messages, tools: tools)
 ```
 
+## Error Handling
+
+All non-streaming API methods return error information as a hash when requests fail:
+
+```ruby
+response = client.chat(messages, tools)
+
+if response["code"]
+  puts "Error #{response["code"]}: #{response["body"]}"
+else
+  puts response.dig('choices', 0, 'message', 'content')
+end
+```
+
+Streaming methods still raise exceptions on HTTP errors.
+
 ## API Coverage
 
 ### OpenAI