Skip to content

Commit 3c08e83

Browse files
authored
finish reason error (#1907)
- **Export finish reason error** - **update docs** - **more docs**
1 parent 724940b commit 3c08e83

41 files changed

Lines changed: 1292 additions & 18 deletions

Some content is hidden

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

engine/language_client_python/python_src/baml_py/errors.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
BamlClientError,
44
BamlInvalidArgumentError,
55
)
6-
from .internal_monkeypatch import BamlValidationError, BamlClientHttpError
6+
from .internal_monkeypatch import (
7+
BamlValidationError,
8+
BamlClientHttpError,
9+
BamlClientFinishReasonError,
10+
)
711

812

913
__all__ = [
@@ -12,4 +16,5 @@
1216
"BamlClientHttpError",
1317
"BamlInvalidArgumentError",
1418
"BamlValidationError",
19+
"BamlClientFinishReasonError",
1520
]

fern/03-reference/baml/clients/providers/aws-bedrock.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ client<llm> MyClient {
1616
max_tokens 100
1717
temperature 0.7
1818
}
19+
// Pass any other parameters that are model specific,
20+
// like with claude thinking models.
21+
additional_model_request_fields {
22+
thinking {
23+
type "enabled"
24+
budget_tokens 1030
25+
}
26+
}
1927
}
2028
}
2129
```

fern/03-reference/baml_client/errors/baml-client-finish-reason-error.mdx

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
client<llm> OpenAIWithFinishReasonError {
2+
provider openai
3+
options {
4+
api_key env.OPENAI_API_KEY
5+
model "gpt-4"
6+
max_tokens 10
7+
finish_reason_allow_list ["stop"]
8+
}
9+
}
10+
11+
function TestOpenAIWithFinishReasonError(input: string) -> string {
12+
client OpenAIWithFinishReasonError
13+
prompt #"
14+
{{ _.role("user") }} Write a haiku.
15+
"#
16+
}

integ-tests/go/baml_client/client.go

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integ-tests/go/baml_client/inlinedbaml.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integ-tests/openapi/baml_client/openapi.yaml

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integ-tests/python/baml_client/async_client.py

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integ-tests/python/baml_client/async_request.py

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)