Skip to content

Commit 0bad7ba

Browse files
committed
Refactor content generation API and purge legacy documentation
This commit implements a major refactoring of the core generation logic by removing the Gemini.Generate module and migrating its functionality into the Gemini.APIs.Coordinator namespace. This change unifies the interface for content generation and streaming across the library. Primary modifications: - Deleted the legacy lib/gemini/apis/generate.ex file. - Transitioned examples to use the Coordinator for generate_content calls. - Updated tool calling demos to use internal parsing helpers within the Coordinator module. - Removed the oldDocs directory containing obsolete design specifications, telemetry requirements, and refactoring plans. - Simplified generate_parsing_test.exs by moving general response parsing tests to the Coordinator and retaining only tool result helpers. These changes reduce technical debt by eliminating redundant documentation and consolidating the service orchestration layer.
1 parent 919a6b6 commit 0bad7ba

File tree

84 files changed

+11
-25568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+11
-25568
lines changed

examples/demo_unified.exs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ defmodule UnifiedArchitectureDemo do
159159
end
160160

161161
defp demo_backward_compatibility do
162-
IO.puts("\n🔄 Backward Compatibility Demo")
162+
IO.puts("\n🔄 API Compatibility Demo")
163163
IO.puts("-" |> String.duplicate(30))
164164

165165
# Show that existing APIs still work
166-
IO.puts("Testing existing API functions...")
166+
IO.puts("Testing API functions...")
167167

168168
# These would normally make real API calls, but we'll show they compile and run
169169
try do
170170
# This will fail with auth errors, but shows the API is compatible
171-
case Gemini.Generate.content("Hello, world!") do
171+
case Gemini.APIs.Coordinator.generate_content("Hello, world!") do
172172
{:ok, _response} ->
173173
IO.puts("✅ generate_content API compatible")
174174

@@ -180,15 +180,6 @@ defmodule UnifiedArchitectureDemo do
180180
IO.puts("✅ generate_content API compatible (compilation successful)")
181181
end
182182

183-
# Show that build_generate_request is now public
184-
try do
185-
request = Gemini.Generate.build_generate_request("Test", [])
186-
IO.puts("✅ build_generate_request is public: #{map_size(request)} fields")
187-
rescue
188-
error ->
189-
IO.puts("❌ build_generate_request error: #{inspect(error)}")
190-
end
191-
192183
# Test configuration functions
193184
model = Gemini.Config.default_model()
194185
IO.puts("✅ Default model: #{model}")

examples/tool_calling_demo.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Tool Calling Demo
44
# This example demonstrates the deserialization and serialization of tool calling data
55

6-
alias Gemini.Generate
6+
alias Gemini.APIs.Coordinator
77
alias Gemini.Types.Content
88
alias Altar.ADM.ToolResult
99

@@ -33,7 +33,7 @@ mock_api_response = %{
3333
]
3434
}
3535

36-
case Generate.parse_generate_response(mock_api_response) do
36+
case Coordinator.__test_parse_generate_response__(mock_api_response) do
3737
{:ok, response} ->
3838
IO.puts("✅ Successfully parsed response!")
3939

@@ -107,7 +107,7 @@ malformed_response = %{
107107
]
108108
}
109109

110-
case Generate.parse_generate_response(malformed_response) do
110+
case Coordinator.__test_parse_generate_response__(malformed_response) do
111111
{:ok, _response} ->
112112
IO.puts("❌ Should have failed!")
113113

0 commit comments

Comments
 (0)