Skip to content

Commit 17f67df

Browse files
agammclaude
andcommitted
Release v0.4.0 - Google Gemini Provider
Major Features: - Full Google Gemini provider support with native batch API - 50% cost savings through Google's batch processing - Support for 5 Gemini models (gemini-2.5-flash, gemini-2.5-pro, etc.) - Structured output and file processing support - Token counting using Google's official API Improvements: - Better exception handling with specific error types - File path sanitization for batch IDs with slashes - Cost estimation follows Anthropic pattern (returns 0 when tokencost unavailable) - Added google-genai dependency for proper CI/CD support - Updated documentation and README Bug Fixes: - Fixed JSON serialization issues with GenerateContentResponse - Fixed DOCX file type incorrectly listed for Gemini - Fixed CI failures due to missing google-genai dependency - Fixed batch ID sanitization for file saving 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 98074c5 commit 17f67df

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Unified Python API for AI Batch requests with cost tracking, Pydantic responses,
66

77
<img width="1328" height="598" alt="image" src="https://github.com/user-attachments/assets/b1b43070-f664-41a2-a85d-e2c589df556c" />
88

9-
*This library is currently in alpha - so there will be breaking changes*
9+
*This library is currently in beta - so there will be breaking changes*
1010

1111
## Why AI-batching?
1212

13-
AI providers offer batch APIs that process requests asynchronously at 50% reduced cost compared to real-time APIs. This is ideal for workloads like document processing, data analysis, and content generation where immediate responses aren't required. However, managing batch jobs across providers, tracking costs, handling failures, and mapping citations back to source documents quickly becomes complex - that's where Batchata comes in.
13+
AI providers offer batch APIs that process requests asynchronously at 50% reduced cost compared to real-time APIs. This is ideal for offline or batch processing tasks. However, managing batch jobs across providers, tracking costs, handling failures, and mapping citations back to source documents quickly becomes complex - that's where Batchata comes in.
1414

1515
## Batchata Features
1616

docs/batchata.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3143,13 +3143,13 @@ <h2 id="configuration">Configuration</h2>
31433143
</span><span id="Job-13"><a href="#Job-13"><span class="linenos">13</span></a><span class="k">class</span><span class="w"> </span><span class="nc">Job</span><span class="p">:</span>
31443144
</span><span id="Job-14"><a href="#Job-14"><span class="linenos">14</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Configuration for a single AI job.</span>
31453145
</span><span id="Job-15"><a href="#Job-15"><span class="linenos">15</span></a><span class="sd"> </span>
3146-
</span><span id="Job-16"><a href="#Job-16"><span class="linenos">16</span></a><span class="sd"> Either provide messages OR file+prompt, not both.</span>
3146+
</span><span id="Job-16"><a href="#Job-16"><span class="linenos">16</span></a><span class="sd"> Either provide messages OR prompt (with optional file), not both.</span>
31473147
</span><span id="Job-17"><a href="#Job-17"><span class="linenos">17</span></a><span class="sd"> </span>
31483148
</span><span id="Job-18"><a href="#Job-18"><span class="linenos">18</span></a><span class="sd"> Attributes:</span>
31493149
</span><span id="Job-19"><a href="#Job-19"><span class="linenos">19</span></a><span class="sd"> id: Unique identifier for the job</span>
31503150
</span><span id="Job-20"><a href="#Job-20"><span class="linenos">20</span></a><span class="sd"> messages: Chat messages for direct message input</span>
3151-
</span><span id="Job-21"><a href="#Job-21"><span class="linenos">21</span></a><span class="sd"> file: File path for file-based input</span>
3152-
</span><span id="Job-22"><a href="#Job-22"><span class="linenos">22</span></a><span class="sd"> prompt: Prompt to use with file input</span>
3151+
</span><span id="Job-21"><a href="#Job-21"><span class="linenos">21</span></a><span class="sd"> file: Optional file path for file-based input</span>
3152+
</span><span id="Job-22"><a href="#Job-22"><span class="linenos">22</span></a><span class="sd"> prompt: Prompt text (can be used alone or with file)</span>
31533153
</span><span id="Job-23"><a href="#Job-23"><span class="linenos">23</span></a><span class="sd"> model: Model name (e.g., &quot;claude-3-sonnet&quot;)</span>
31543154
</span><span id="Job-24"><a href="#Job-24"><span class="linenos">24</span></a><span class="sd"> temperature: Sampling temperature (0.0-1.0)</span>
31553155
</span><span id="Job-25"><a href="#Job-25"><span class="linenos">25</span></a><span class="sd"> max_tokens: Maximum tokens to generate</span>
@@ -3175,8 +3175,8 @@ <h2 id="configuration">Configuration</h2>
31753175
</span><span id="Job-45"><a href="#Job-45"><span class="linenos">45</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">prompt</span><span class="p">:</span>
31763176
</span><span id="Job-46"><a href="#Job-46"><span class="linenos">46</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;File input requires a prompt&quot;</span><span class="p">)</span>
31773177
</span><span id="Job-47"><a href="#Job-47"><span class="linenos">47</span></a>
3178-
</span><span id="Job-48"><a href="#Job-48"><span class="linenos">48</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">messages</span> <span class="ow">and</span> <span class="ow">not</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">prompt</span><span class="p">):</span>
3179-
</span><span id="Job-49"><a href="#Job-49"><span class="linenos">49</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Must provide either messages or file+prompt&quot;</span><span class="p">)</span>
3178+
</span><span id="Job-48"><a href="#Job-48"><span class="linenos">48</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">messages</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">prompt</span><span class="p">:</span>
3179+
</span><span id="Job-49"><a href="#Job-49"><span class="linenos">49</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Must provide either messages or prompt&quot;</span><span class="p">)</span>
31803180
</span><span id="Job-50"><a href="#Job-50"><span class="linenos">50</span></a>
31813181
</span><span id="Job-51"><a href="#Job-51"><span class="linenos">51</span></a> <span class="k">def</span><span class="w"> </span><span class="nf">to_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]:</span>
31823182
</span><span id="Job-52"><a href="#Job-52"><span class="linenos">52</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Serialize for state persistence.&quot;&quot;&quot;</span>
@@ -3218,13 +3218,13 @@ <h2 id="configuration">Configuration</h2>
32183218

32193219
<div class="docstring"><p>Configuration for a single AI job.</p>
32203220

3221-
<p>Either provide messages OR file+prompt, not both.</p>
3221+
<p>Either provide messages OR prompt (with optional file), not both.</p>
32223222

32233223
<p>Attributes:
32243224
id: Unique identifier for the job
32253225
messages: Chat messages for direct message input
3226-
file: File path for file-based input
3227-
prompt: Prompt to use with file input
3226+
file: Optional file path for file-based input
3227+
prompt: Prompt text (can be used alone or with file)
32283228
model: Model name (e.g., "claude-3-sonnet")
32293229
temperature: Sampling temperature (0.0-1.0)
32303230
max_tokens: Maximum tokens to generate

0 commit comments

Comments
 (0)