-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The request body for Vertex calls was malformed. Example function: ```baml function TestVertexWithSystemInstructions() -> string { client Vertex prompt #"{{_.role("system")}} You are a helpful assistant {{_.role("user")}} Write a poem about llamas "# } ``` Request body: ```json { "contents": [ { "role": "system", "parts": [ { "text": "You are a helpful assistant" } ] }, { "role": "user", "parts": [ { "text": "Write a poem about llamas" } ] } ] } ``` The expected JSON should look like this: ```json { "system_instruction": { "parts": { "text": "You are a helpful assistant" } }, "contents": [ { "role": "user", "parts": [ { "text": "Write a poem about llamas" } ] } ] } ``` This PR updates the vertex client with the correct syntax. - [Gemini API Docs](https://ai.google.dev/gemini-api/docs/text-generation?lang=rest#system-instructions) - [Discord Thread (Bug Report)](https://discord.com/channels/1119368998161752075/1326035112852328541/1326979978050408582) <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Fixes Vertex client request body to correctly handle system instructions and adds related tests. > > - **Behavior**: > - Fixes request body format in `vertex_client.rs` to correctly handle system instructions by separating them from user content. > - Logs a warning if multiple system instructions are provided, using only the last one. > - **Testing**: > - Adds `TestVertexWithSystemInstructions` function in `vertex.baml` and `async_client.py`. > - Adds test case `should support vertex with system instructions` in `vertex.test.ts`. > - **Misc**: > - Adds `CustomRetry` policy in `prompt_fiddle_example.baml`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for 52350de. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
- Loading branch information
1 parent
1ea1d8b
commit 4b7db0f
Showing
15 changed files
with
311 additions
and
871 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,4 +250,3 @@ client<llm> TogetherAi { | |
model "meta-llama/Llama-3-70b-chat-hf" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.