Skip to content

Commit

Permalink
Use GEMINI_JSON as default
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjcastillo committed Dec 27, 2024
1 parent 887316c commit 25045ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/concepts/patching.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Gemini tool calling comes with some known limitations:
- Gemini tool calling is incompatible with Pydantic schema customizations such as examples due to API limitations and may result in errors
- Gemini can sometimes call the wrong function name, resulting in malformed or invalid json
- Gemini tool calling could fail with enum and literal field types
- Gemini tool calling doesn't preserve the order of the fields in the response. Don't rely on the order of the fields in the response.

```python
import instructor
Expand All @@ -45,7 +46,7 @@ client = instructor.from_gemini(
)
```

### Gemini Vertex AI Tool Callin
### Gemini Vertex AI Tool Calling

This method allows us to get structured output from Gemini via tool calling with the Vertex AI SDK.

Expand Down
12 changes: 7 additions & 5 deletions instructor/client_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@
@overload
def from_gemini(
client: genai.GenerativeModel,
mode: instructor.Mode = instructor.Mode.GEMINI_TOOLS,
mode: instructor.Mode = instructor.Mode.GEMINI_JSON,
use_async: Literal[True] = True,
**kwargs: Any,
) -> instructor.AsyncInstructor: ...
) -> instructor.AsyncInstructor:
...


@overload
def from_gemini(
client: genai.GenerativeModel,
mode: instructor.Mode = instructor.Mode.GEMINI_TOOLS,
mode: instructor.Mode = instructor.Mode.GEMINI_JSON,
use_async: Literal[False] = False,
**kwargs: Any,
) -> instructor.Instructor: ...
) -> instructor.Instructor:
...


def from_gemini(
client: genai.GenerativeModel,
mode: instructor.Mode = instructor.Mode.GEMINI_TOOLS,
mode: instructor.Mode = instructor.Mode.GEMINI_JSON,
use_async: bool = False,
**kwargs: Any,
) -> instructor.Instructor | instructor.AsyncInstructor:
Expand Down

0 comments on commit 25045ab

Please sign in to comment.