llm_gateway 0.9.0 → 0.10.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +149 -64
  4. data/Rakefile +5 -0
  5. data/docs/migration_guide_0.10.0.md +53 -0
  6. data/docs/structured-output.md +28 -0
  7. data/lib/llm_gateway/adapter_definition.rb +64 -0
  8. data/lib/llm_gateway/adapters/adapter.rb +105 -21
  9. data/lib/llm_gateway/adapters/anthropic/messages_adapter.rb +8 -0
  10. data/lib/llm_gateway/adapters/anthropic_option_mapper.rb +29 -19
  11. data/lib/llm_gateway/adapters/groq/chat_completions_adapter.rb +8 -0
  12. data/lib/llm_gateway/adapters/groq/option_mapper.rb +7 -9
  13. data/lib/llm_gateway/adapters/normalized_stream_accumulator.rb +7 -3
  14. data/lib/llm_gateway/adapters/openai/chat_completions/option_mapper.rb +7 -9
  15. data/lib/llm_gateway/adapters/openai/chat_completions/stream_mapper.rb +1 -1
  16. data/lib/llm_gateway/adapters/openai/chat_completions_adapter.rb +6 -0
  17. data/lib/llm_gateway/adapters/openai/responses/option_mapper.rb +11 -9
  18. data/lib/llm_gateway/adapters/openai/responses/stream_mapper.rb +1 -1
  19. data/lib/llm_gateway/adapters/openai/responses_adapter.rb +6 -0
  20. data/lib/llm_gateway/adapters/openai_codex/responses_adapter.rb +8 -0
  21. data/lib/llm_gateway/adapters/stream_mapper.rb +4 -3
  22. data/lib/llm_gateway/agents/harness.rb +63 -29
  23. data/lib/llm_gateway/agents/in_memory_session_manager.rb +35 -4
  24. data/lib/llm_gateway/agents/tools/tool_utils.rb +2 -2
  25. data/lib/llm_gateway/errors.rb +3 -0
  26. data/lib/llm_gateway/models/catalog.rb +68 -0
  27. data/lib/llm_gateway/models/cost_calculator.rb +47 -0
  28. data/lib/llm_gateway/models/definition.rb +325 -0
  29. data/lib/llm_gateway/models/explicit.rb +46 -0
  30. data/lib/llm_gateway/models/generated.json +3055 -0
  31. data/lib/llm_gateway/models.rb +78 -0
  32. data/lib/llm_gateway/prompt.rb +13 -13
  33. data/lib/llm_gateway/proxy/adapter.rb +22 -12
  34. data/lib/llm_gateway/proxy/client.rb +4 -4
  35. data/lib/llm_gateway/proxy/protocol.rb +50 -0
  36. data/lib/llm_gateway/proxy/server.rb +12 -9
  37. data/lib/llm_gateway/utils.rb +12 -6
  38. data/lib/llm_gateway/version.rb +1 -1
  39. data/lib/llm_gateway.rb +4 -67
  40. data/scripts/generate_model_catalog.rb +195 -0
  41. metadata +13 -4
  42. data/lib/llm_gateway/client.rb +0 -35
  43. data/lib/llm_gateway/provider_registry.rb +0 -37
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - billybonks
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-13 00:00:00.000000000 Z
11
+ date: 2026-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -42,10 +42,13 @@ files:
42
42
  - README.md
43
43
  - Rakefile
44
44
  - docs/migration-guide.md
45
+ - docs/migration_guide_0.10.0.md
45
46
  - docs/migration_guide_0.6.0.md
46
47
  - docs/migration_guide_0.7.0.md
47
48
  - docs/migration_guide_0.9.0.md
49
+ - docs/structured-output.md
48
50
  - lib/llm_gateway.rb
51
+ - lib/llm_gateway/adapter_definition.rb
49
52
  - lib/llm_gateway/adapters/adapter.rb
50
53
  - lib/llm_gateway/adapters/anthropic/acts_like_messages.rb
51
54
  - lib/llm_gateway/adapters/anthropic/input_mapper.rb
@@ -87,7 +90,6 @@ files:
87
90
  - lib/llm_gateway/agents/tools/tool_utils.rb
88
91
  - lib/llm_gateway/agents/tools/write_tool.rb
89
92
  - lib/llm_gateway/base_client.rb
90
- - lib/llm_gateway/client.rb
91
93
  - lib/llm_gateway/clients/anthropic.rb
92
94
  - lib/llm_gateway/clients/claude_code/oauth_flow.rb
93
95
  - lib/llm_gateway/clients/claude_code/token_manager.rb
@@ -96,16 +98,23 @@ files:
96
98
  - lib/llm_gateway/clients/openai_codex/oauth_flow.rb
97
99
  - lib/llm_gateway/clients/openai_codex/token_manager.rb
98
100
  - lib/llm_gateway/errors.rb
101
+ - lib/llm_gateway/models.rb
102
+ - lib/llm_gateway/models/catalog.rb
103
+ - lib/llm_gateway/models/cost_calculator.rb
104
+ - lib/llm_gateway/models/definition.rb
105
+ - lib/llm_gateway/models/explicit.rb
106
+ - lib/llm_gateway/models/generated.json
99
107
  - lib/llm_gateway/prompt.rb
100
- - lib/llm_gateway/provider_registry.rb
101
108
  - lib/llm_gateway/proxy/adapter.rb
102
109
  - lib/llm_gateway/proxy/client.rb
110
+ - lib/llm_gateway/proxy/protocol.rb
103
111
  - lib/llm_gateway/proxy/server.rb
104
112
  - lib/llm_gateway/tool.rb
105
113
  - lib/llm_gateway/utils.rb
106
114
  - lib/llm_gateway/version.rb
107
115
  - scripts/create_anthropic_credentials.rb
108
116
  - scripts/create_openai_codex_credentials.rb
117
+ - scripts/generate_model_catalog.rb
109
118
  - sig/llm_gateway.rbs
110
119
  homepage: https://github.com/Hyper-Unearthing/llm_gateway
111
120
  licenses:
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
-
4
- module LlmGateway
5
- class Client
6
- def self.provider_id_from_client(client)
7
- case client
8
- when LlmGateway::Clients::Anthropic
9
- "anthropic"
10
- when LlmGateway::Clients::OpenAI
11
- "openai"
12
- when LlmGateway::Clients::Groq
13
- "groq"
14
- end
15
- end
16
-
17
- def self.upload_file(provider, **kwargs)
18
- api_key = kwargs.delete(:api_key)
19
- adapter = LlmGateway.build_provider(
20
- provider: provider,
21
- api_key: api_key
22
- )
23
- adapter.upload_file(**kwargs)
24
- end
25
-
26
- def self.download_file(provider, **kwargs)
27
- api_key = kwargs.delete(:api_key)
28
- adapter = LlmGateway.build_provider(
29
- provider: provider,
30
- api_key: api_key
31
- )
32
- adapter.download_file(**kwargs)
33
- end
34
- end
35
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LlmGateway
4
- class ProviderRegistry
5
- class << self
6
- def register(name, client:, adapter:)
7
- registry[name.to_s] = { client: client, adapter: adapter }
8
- end
9
-
10
- def resolve(name)
11
- name = name.to_s
12
- entry = registry[name]
13
- raise Errors::UnsupportedProvider, "Unknown provider: #{name}" unless entry
14
-
15
- entry
16
- end
17
-
18
- def registered?(name)
19
- registry.key?(name.to_s)
20
- end
21
-
22
- def providers
23
- registry.keys
24
- end
25
-
26
- def reset!
27
- @registry = {}
28
- end
29
-
30
- private
31
-
32
- def registry
33
- @registry ||= {}
34
- end
35
- end
36
- end
37
- end