Skip to content

Commit

Permalink
Merge branch 'main' into feature/sambanovacloud_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-92 authored Dec 16, 2024
2 parents a8b1f94 + a953b99 commit 2255be8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/integrations/google.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This guide will show you how to use Instructor with the Google.GenerativeAI libr
Google's Gemini models provide powerful AI capabilities with multimodal support. This guide shows you how to use Instructor with Google's Gemini models for type-safe, validated responses.

```bash
pip install "instructor[google-generativeai]
pip install "instructor[google-generativeai, vertexai]"
```

## Simple User Example (Sync)
Expand Down
8 changes: 6 additions & 2 deletions instructor/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class RequestBody(BaseModel):

class BatchModel(BaseModel):
custom_id: str
params: RequestBody
body: RequestBody
url: str
method: str


class BatchJob:
Expand Down Expand Up @@ -149,12 +151,14 @@ def create_from_messages(
for messages in messages_batch:
batch_model = BatchModel(
custom_id=str(uuid.uuid4()),
params=RequestBody(
body=RequestBody(
model=model,
messages=messages,
max_tokens=max_tokens,
temperature=temperature,
**kwargs,
),
method="POST",
url="/v1/chat/completions"
)
file.write(batch_model.model_dump_json() + "\n")
2 changes: 1 addition & 1 deletion instructor/dsl/simple_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __class_getitem__(cls, response_model: type[BaseModel]) -> type[BaseModel]:
return create_model(
"Response",
content=(response_model, ...),
__doc__="Correctly Formated and Extracted Response.",
__doc__="Correctly Formatted and Extracted Response.",
__base__=(AdapterBase, OpenAISchema),
)

Expand Down
2 changes: 1 addition & 1 deletion instructor/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def initialize_usage(mode: Mode) -> CompletionUsage | Any:
"""
total_usage = CompletionUsage(completion_tokens=0, prompt_tokens=0, total_tokens=0,
completion_tokens_details = CompletionTokensDetails(audio_tokens=0, reasoning_tokens=0),
prompt_token_details = PromptTokensDetails(audio_tokens=0, cached_tokens=0)
prompt_tokens_details = PromptTokensDetails(audio_tokens=0, cached_tokens=0)
)
if mode in {Mode.ANTHROPIC_TOOLS, Mode.ANTHROPIC_JSON}:
from anthropic.types import Usage as AnthropicUsage
Expand Down

0 comments on commit 2255be8

Please sign in to comment.