llm.rb 16.0.0 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +510 -2
  3. data/README.md +857 -501
  4. data/data/alibaba.json +2 -2
  5. data/data/anthropic.json +66 -3
  6. data/data/bedrock.json +781 -12
  7. data/data/deepinfra.json +157 -1
  8. data/data/google.json +48 -0
  9. data/data/mistral.json +326 -16
  10. data/data/moonshot.json +2 -1
  11. data/data/openai.json +13 -0
  12. data/data/openrouter.json +1078 -1235
  13. data/data/xai.json +4 -2
  14. data/docs/deepdive/advanced/cancellation.md +35 -7
  15. data/docs/deepdive/advanced/compaction.md +5 -5
  16. data/docs/deepdive/advanced/context.md +45 -24
  17. data/docs/deepdive/advanced/{guard.md → intercept.md} +87 -83
  18. data/docs/deepdive/features/builtin_tools.md +1 -1
  19. data/docs/deepdive/features/concurrency.md +15 -10
  20. data/docs/deepdive/features/database.md +19 -19
  21. data/docs/deepdive/features/embeddings.md +4 -4
  22. data/docs/deepdive/features/files.md +7 -5
  23. data/docs/deepdive/fundamentals/agents.md +13 -8
  24. data/docs/deepdive/fundamentals/providers.md +1 -1
  25. data/docs/deepdive/fundamentals/schema.md +2 -2
  26. data/docs/deepdive/fundamentals/stream.md +8 -8
  27. data/docs/deepdive/fundamentals/tools.md +14 -14
  28. data/docs/deepdive/media/ocr.md +1 -1
  29. data/docs/deepdive/protocols/a2a.md +3 -3
  30. data/docs/deepdive/protocols/mcp.md +116 -7
  31. data/docs/deepdive/reference/cost.md +1 -1
  32. data/docs/deepdive/reference/response.md +1 -1
  33. data/docs/deepdive/reference/tracer.md +90 -22
  34. data/docs/deepdive.md +1 -1
  35. data/lib/llm/agent/interrupt.rb +35 -46
  36. data/lib/llm/agent/registry.rb +106 -0
  37. data/lib/llm/agent.rb +244 -269
  38. data/lib/llm/context.rb +63 -55
  39. data/lib/llm/function/array.rb +2 -1
  40. data/lib/llm/function/async/group.rb +2 -2
  41. data/lib/llm/function/async/task.rb +25 -48
  42. data/lib/llm/function/fiber/group.rb +2 -2
  43. data/lib/llm/function/fiber/task.rb +16 -30
  44. data/lib/llm/function/fork/group.rb +2 -2
  45. data/lib/llm/function/fork/job.rb +8 -4
  46. data/lib/llm/function/fork/task.rb +25 -30
  47. data/lib/llm/function/group.rb +33 -5
  48. data/lib/llm/function/ractor/group.rb +2 -2
  49. data/lib/llm/function/ractor/job.rb +8 -6
  50. data/lib/llm/function/ractor/task.rb +32 -9
  51. data/lib/llm/function/sequential/group.rb +2 -1
  52. data/lib/llm/function/sequential/task.rb +8 -1
  53. data/lib/llm/function/task.rb +52 -4
  54. data/lib/llm/function/thread/group.rb +2 -2
  55. data/lib/llm/function/thread/task.rb +36 -10
  56. data/lib/llm/function/window.rb +16 -0
  57. data/lib/llm/function.rb +14 -43
  58. data/lib/llm/intercept/multi.rb +40 -0
  59. data/lib/llm/intercept/null.rb +18 -0
  60. data/lib/llm/intercept.rb +96 -0
  61. data/lib/llm/message.rb +1 -1
  62. data/lib/llm/provider.rb +16 -1
  63. data/lib/llm/providers/anthropic/stream_parser.rb +1 -1
  64. data/lib/llm/providers/bedrock/stream_parser.rb +1 -1
  65. data/lib/llm/providers/deepseek/files.rb +49 -0
  66. data/lib/llm/providers/deepseek/request_adapter/completion.rb +15 -13
  67. data/lib/llm/providers/deepseek.rb +16 -2
  68. data/lib/llm/providers/google/stream_parser.rb +1 -1
  69. data/lib/llm/providers/openai/responses/stream_parser.rb +1 -1
  70. data/lib/llm/providers/openai/stream_parser.rb +1 -1
  71. data/lib/llm/stream.rb +8 -7
  72. data/lib/llm/tool.rb +1 -1
  73. data/lib/llm/tools/utils.rb +1 -1
  74. data/lib/llm/tracer/logger.rb +42 -1
  75. data/lib/llm/tracer/multi.rb +144 -0
  76. data/lib/llm/tracer/null.rb +20 -0
  77. data/lib/llm/tracer/pretty_logger.rb +33 -2
  78. data/lib/llm/tracer/rescue.rb +110 -0
  79. data/lib/llm/tracer/telemetry.rb +69 -4
  80. data/lib/llm/tracer.rb +125 -48
  81. data/lib/llm/utils.rb +12 -2
  82. data/lib/llm/version.rb +1 -1
  83. data/lib/llm.rb +36 -1
  84. data/llm.gemspec +9 -4
  85. metadata +16 -35
  86. data/lib/llm/function/tracing.rb +0 -21
  87. data/lib/llm/guard/null.rb +0 -19
  88. data/lib/llm/guard.rb +0 -55
data/data/alibaba.json CHANGED
@@ -2299,8 +2299,8 @@
2299
2299
  "output": 4096
2300
2300
  },
2301
2301
  "cost": {
2302
- "input": 0.72,
2303
- "output": 0.72
2302
+ "input": 0.07,
2303
+ "output": 0.16
2304
2304
  }
2305
2305
  }
2306
2306
  }
data/data/anthropic.json CHANGED
@@ -130,7 +130,7 @@
130
130
  },
131
131
  "open_weights": false,
132
132
  "limit": {
133
- "context": 1000000,
133
+ "context": 200000,
134
134
  "output": 64000
135
135
  },
136
136
  "cost": {
@@ -518,7 +518,7 @@
518
518
  },
519
519
  "open_weights": false,
520
520
  "limit": {
521
- "context": 1000000,
521
+ "context": 200000,
522
522
  "output": 64000
523
523
  },
524
524
  "cost": {
@@ -669,6 +669,69 @@
669
669
  "cache_write": 1.25
670
670
  }
671
671
  },
672
+ "claude-haiku-5-5": {
673
+ "id": "claude-haiku-5-5",
674
+ "name": "Claude Haiku 5.5",
675
+ "description": "Fast Claude model for responsive assistance, classification, and lightweight agents",
676
+ "family": "claude-haiku",
677
+ "attachment": true,
678
+ "reasoning": true,
679
+ "reasoning_options": [
680
+ {
681
+ "type": "toggle"
682
+ },
683
+ {
684
+ "type": "effort",
685
+ "values": [
686
+ "low",
687
+ "medium",
688
+ "high",
689
+ "xhigh",
690
+ "max"
691
+ ]
692
+ }
693
+ ],
694
+ "tool_call": true,
695
+ "structured_output": true,
696
+ "temperature": false,
697
+ "knowledge": "2026-06",
698
+ "release_date": "2026-10-07",
699
+ "last_updated": "2026-10-07",
700
+ "modalities": {
701
+ "input": [
702
+ "text",
703
+ "image",
704
+ "pdf"
705
+ ],
706
+ "output": [
707
+ "text"
708
+ ]
709
+ },
710
+ "open_weights": false,
711
+ "limit": {
712
+ "context": 1000000,
713
+ "output": 128000
714
+ },
715
+ "cost": {
716
+ "input": 0.1,
717
+ "output": 0.5,
718
+ "cache_read": 0.01,
719
+ "cache_write": 0.125,
720
+ "tiers": [
721
+ {
722
+ "input": 0.5,
723
+ "output": 2.5,
724
+ "cache_read": 0.05,
725
+ "cache_write": 0.625,
726
+ "tier": {
727
+ "type": "context",
728
+ "size": 100000
729
+ }
730
+ }
731
+ ]
732
+ },
733
+ "canonical_model_id": "anthropic/claude-haiku-5-5"
734
+ },
672
735
  "claude-sonnet-4-6": {
673
736
  "id": "claude-sonnet-4-6",
674
737
  "name": "Claude Sonnet 4.6",
@@ -762,7 +825,7 @@
762
825
  "cost": {
763
826
  "input": 2,
764
827
  "output": 10,
765
- "cache_read": 0.2,
828
+ "cache_read": 0.1,
766
829
  "cache_write": 2.5
767
830
  },
768
831
  "canonical_model_id": "anthropic/claude-sonnet-5-5"