laiya 0.0.2

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 (44) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/bin/laiya +20 -0
  4. data/context/chatgpt-codex.md +43 -0
  5. data/context/getting-started.md +49 -0
  6. data/context/http-api.md +49 -0
  7. data/context/index.yaml +26 -0
  8. data/context/providers-and-models.md +104 -0
  9. data/examples/chatgpt/authentication.rb +45 -0
  10. data/examples/chatgpt/readme.md +107 -0
  11. data/examples/chatgpt/service.rb +34 -0
  12. data/guides/chatgpt-codex/readme.md +43 -0
  13. data/guides/getting-started/readme.md +49 -0
  14. data/guides/http-api/readme.md +49 -0
  15. data/guides/index.md +14 -0
  16. data/guides/links.yaml +8 -0
  17. data/guides/providers-and-models/readme.md +104 -0
  18. data/lib/laiya/configuration/builder.rb +40 -0
  19. data/lib/laiya/configuration.rb +152 -0
  20. data/lib/laiya/environment/application.rb +53 -0
  21. data/lib/laiya/models/catalog.rb +108 -0
  22. data/lib/laiya/models/discover.rb +110 -0
  23. data/lib/laiya/provider/codex/authentication.rb +185 -0
  24. data/lib/laiya/provider/codex/request.rb +136 -0
  25. data/lib/laiya/provider/codex/response.rb +117 -0
  26. data/lib/laiya/provider/codex/responses.rb +93 -0
  27. data/lib/laiya/provider/codex/server_sent_events.rb +78 -0
  28. data/lib/laiya/provider/codex.rb +298 -0
  29. data/lib/laiya/provider/interface.rb +19 -0
  30. data/lib/laiya/provider/ollama.rb +22 -0
  31. data/lib/laiya/provider/openai.rb +92 -0
  32. data/lib/laiya/provider.rb +10 -0
  33. data/lib/laiya/router.rb +85 -0
  34. data/lib/laiya/service/application.rb +50 -0
  35. data/lib/laiya/version.rb +8 -0
  36. data/lib/laiya/web/application.rb +48 -0
  37. data/lib/laiya/web.rb +6 -0
  38. data/lib/laiya.rb +19 -0
  39. data/license.md +21 -0
  40. data/readme.md +68 -0
  41. data/releases.md +7 -0
  42. data.tar.gz.sig +0 -0
  43. metadata +162 -0
  44. metadata.gz.sig +3 -0
data/readme.md ADDED
@@ -0,0 +1,68 @@
1
+ # Laiya
2
+
3
+ The AI layer for Ruby.
4
+
5
+ [![Development Status](https://github.com/socketry/laiya/workflows/Test/badge.svg)](https://github.com/socketry/laiya/actions?workflow=Test)
6
+
7
+ Laiya is a play on “Layer AI”: an OpenAI-compatible HTTP API and provider proxy
8
+ built on `Async::HTTP`.
9
+
10
+ ## Motivation
11
+
12
+ LLM providers expose overlapping APIs but differ in authentication, model
13
+ catalogs, and protocol details. Laiya provides a shared OpenAI-compatible HTTP
14
+ surface and routes requests to configured providers, while allowing compatible
15
+ providers to proxy request and response bodies without buffering them.
16
+
17
+ ## Usage
18
+
19
+ Please see the [project documentation](https://socketry.github.io/laiya/) for more details.
20
+
21
+ - [Getting Started](https://socketry.github.io/laiya/guides/getting-started/index) - This guide explains how to install Laiya, configure a provider, and make an OpenAI-compatible request.
22
+
23
+ - [Providers and Models](https://socketry.github.io/laiya/guides/providers-and-models/index) - This guide explains how to route model IDs to providers and when to discover a provider's model catalog.
24
+
25
+ - [HTTP API](https://socketry.github.io/laiya/guides/http-api/index) - This guide explains how Laiya's OpenAI-compatible HTTP API handles routing, proxying, and streaming.
26
+
27
+ - [ChatGPT Codex Provider](https://socketry.github.io/laiya/guides/chatgpt-codex/index) - This guide explains how to run the experimental Codex provider with a ChatGPT login while keeping tool execution on the client.
28
+
29
+ ## Releases
30
+
31
+ Please see the [project releases](https://socketry.github.io/laiya/releases/index) for all releases.
32
+
33
+ ### v0.0.2
34
+
35
+ - Add Laiya's OpenAI-compatible HTTP API and Async::Service launcher.
36
+ - Add OpenAI and Ollama providers with model discovery and configurable model limits.
37
+ - Add an experimental ChatGPT Codex provider using Codex CLI credentials.
38
+
39
+ ## Contributing
40
+
41
+ We welcome contributions to Laiya.
42
+
43
+ ### Running tests
44
+
45
+ ``` sh
46
+ bundle exec bake test
47
+ ```
48
+
49
+ ### Running integration tests
50
+
51
+ The Ollama integration test requires Docker Compose and downloads a small CPU
52
+ model on its first run:
53
+
54
+ ``` sh
55
+ bundle exec bake test:integration name=ollama
56
+ ```
57
+
58
+ ### Making releases
59
+
60
+ ``` sh
61
+ bundle exec bake gem:github:release:patch
62
+ ```
63
+
64
+ See [bake-gem-github](https://github.com/socketry/bake-gem-github) for release setup and process.
65
+
66
+ ### Developer Certificate of Origin
67
+
68
+ Contributions must comply with the [Developer Certificate of Origin](https://developercertificate.org/).
data/releases.md ADDED
@@ -0,0 +1,7 @@
1
+ # Releases
2
+
3
+ ## v0.0.2
4
+
5
+ - Add Laiya's OpenAI-compatible HTTP API and Async::Service launcher.
6
+ - Add OpenAI and Ollama providers with model discovery and configurable model limits.
7
+ - Add an experimental ChatGPT Codex provider using Codex CLI credentials.
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,162 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: laiya
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Williams
8
+ bindir: bin
9
+ cert_chain:
10
+ - |
11
+ -----BEGIN CERTIFICATE-----
12
+ MIIEFDCCAnygAwIBAgIBATANBgkqhkiG9w0BAQsFADAwMREwDwYDVQQKDAhTb2Nr
13
+ ZXRyeTEbMBkGA1UEAwwSU29ja2V0cnkgUnVieSBHZW1zMB4XDTI2MDkyMTA3NTgx
14
+ NFoXDTI3MDkyMTA3NTgxNFowMDERMA8GA1UECgwIU29ja2V0cnkxGzAZBgNVBAMM
15
+ ElNvY2tldHJ5IFJ1YnkgR2VtczCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoC
16
+ ggGBAM/QgjVgDzDo/xJEQoFvAzcVFP7msnswkhPJB2UDsbxXCZmers5jV512TM5s
17
+ NwLHfzJiC4DcI5ax9ZYKM9Q+dS21YYagNqjtg3YPyDqR6phoibEA0VoMuInUQW68
18
+ i5OkCJzYKGD2pY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CK9Rdg==
34
+ -----END CERTIFICATE-----
35
+ date: 1980-01-02 00:00:00.000000000 Z
36
+ dependencies:
37
+ - !ruby/object:Gem::Dependency
38
+ name: async
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ - !ruby/object:Gem::Dependency
52
+ name: async-http
53
+ requirement: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ type: :runtime
59
+ prerelease: false
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ - !ruby/object:Gem::Dependency
66
+ name: async-service
67
+ requirement: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ type: :runtime
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: base64
81
+ requirement: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ executables:
94
+ - laiya
95
+ extensions: []
96
+ extra_rdoc_files: []
97
+ files:
98
+ - bin/laiya
99
+ - context/chatgpt-codex.md
100
+ - context/getting-started.md
101
+ - context/http-api.md
102
+ - context/index.yaml
103
+ - context/providers-and-models.md
104
+ - examples/chatgpt/authentication.rb
105
+ - examples/chatgpt/readme.md
106
+ - examples/chatgpt/service.rb
107
+ - guides/chatgpt-codex/readme.md
108
+ - guides/getting-started/readme.md
109
+ - guides/http-api/readme.md
110
+ - guides/index.md
111
+ - guides/links.yaml
112
+ - guides/providers-and-models/readme.md
113
+ - lib/laiya.rb
114
+ - lib/laiya/configuration.rb
115
+ - lib/laiya/configuration/builder.rb
116
+ - lib/laiya/environment/application.rb
117
+ - lib/laiya/models/catalog.rb
118
+ - lib/laiya/models/discover.rb
119
+ - lib/laiya/provider.rb
120
+ - lib/laiya/provider/codex.rb
121
+ - lib/laiya/provider/codex/authentication.rb
122
+ - lib/laiya/provider/codex/request.rb
123
+ - lib/laiya/provider/codex/response.rb
124
+ - lib/laiya/provider/codex/responses.rb
125
+ - lib/laiya/provider/codex/server_sent_events.rb
126
+ - lib/laiya/provider/interface.rb
127
+ - lib/laiya/provider/ollama.rb
128
+ - lib/laiya/provider/openai.rb
129
+ - lib/laiya/router.rb
130
+ - lib/laiya/service/application.rb
131
+ - lib/laiya/version.rb
132
+ - lib/laiya/web.rb
133
+ - lib/laiya/web/application.rb
134
+ - license.md
135
+ - readme.md
136
+ - releases.md
137
+ homepage: https://github.com/socketry/laiya
138
+ licenses:
139
+ - MIT
140
+ metadata:
141
+ bug_tracker_uri: https://github.com/socketry/laiya/issues
142
+ changelog_uri: https://github.com/socketry/laiya/blob/main/releases.md
143
+ documentation_uri: https://socketry.github.io/laiya/
144
+ source_code_uri: https://github.com/socketry/laiya.git
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '3.3'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubygems_version: 4.0.21
160
+ specification_version: 4
161
+ summary: An OpenAI-compatible HTTP API and provider proxy
162
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ ����
2
+ w��I�}��%�DP�\�A��{̔"V�Q�Mw�N�(�zf)�E��!�]U���z�,�q��Xd-o�0�WC ���6�~��r��^�u����k'W
3
+ ���b�q�B3)F)�hA�3��pZ����T8�&y~w��9�1  6^�&v%���!�'����K�1� ��ͭ8��<8�m�����u���6~p���