Databricks with the Python SDK
Avi Steinberg
Senior Software Engineer

Hostováno mimo Databricks:


Hostováno na Databricks:
$$



serving_endpoints objektu WorkspaceClientSYSTEM:
Instrukce, jak má model reagovat na dotazy
USER:
Dotazy zasílané modelu uživatelem
Příklad promptu:
"You are a helpful python coding assistant."
Příklad promptu:
"How do for loops work in Python?"
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import ChatMessage, ChatMessageRole
w = WorkspaceClient()
response = w.serving_endpoints.query(
name="databricks-meta-llama-3-3-70b-instruct",
messages=[
ChatMessage(
role=ChatMessageRole.SYSTEM, content="You are a helpful assistant."
),
ChatMessage(role=ChatMessageRole.USER, content="<your-question>"),
],
max_tokens=128)
print(f"RESPONSE:\n{response.choices[0].message.content}")
Databricks with the Python SDK