You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`DATABRICKS_API_KEY` and `DATABRICKS_WORKSPACE_URL` are also supported if you prefer those names. The provider appends `/serving-endpoints` automatically, so the host only needs the base workspace URL.
26
+
25
27
## Basic Example
26
28
27
29
Here's how to extract structured data from Databricks models:
28
30
29
31
```python
30
-
import os
31
32
import instructor
32
-
from openai import OpenAI
33
33
from pydantic import BaseModel
34
34
35
-
# Initialize the client with Databricks base URL
35
+
# Initialize the client; host and token are read from the environment
36
36
client = instructor.from_provider(
37
37
"databricks/dbrx-instruct",
38
38
mode=instructor.Mode.TOOLS,
@@ -55,6 +55,8 @@ print(user)
55
55
# Output: UserExtract(name='Jason', age=25)
56
56
```
57
57
58
+
If you need to point at a different workspace or testing endpoint, pass `base_url="https://alt-workspace.cloud.databricks.com/serving-endpoints"`. The helper will use that value as-is without adding another suffix.
0 commit comments