mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-15 18:42:31 +00:00
add response format to signature
This commit is contained in:
parent
6d26bbdce3
commit
40ba22f4c8
15 changed files with 93 additions and 32 deletions
|
|
@ -53,6 +53,7 @@ class InferenceClient(Inference):
|
|||
tools: Optional[List[ToolDefinition]] = None,
|
||||
tool_choice: Optional[ToolChoice] = ToolChoice.auto,
|
||||
tool_prompt_format: Optional[ToolPromptFormat] = ToolPromptFormat.json,
|
||||
response_format: Optional[ResponseFormat] = None,
|
||||
stream: Optional[bool] = False,
|
||||
logprobs: Optional[LogProbConfig] = None,
|
||||
) -> AsyncGenerator:
|
||||
|
|
@ -63,6 +64,7 @@ class InferenceClient(Inference):
|
|||
tools=tools or [],
|
||||
tool_choice=tool_choice,
|
||||
tool_prompt_format=tool_prompt_format,
|
||||
response_format=response_format,
|
||||
stream=stream,
|
||||
logprobs=logprobs,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -74,13 +74,18 @@ class ChatCompletionResponseEvent(BaseModel):
|
|||
stop_reason: Optional[StopReason] = None
|
||||
|
||||
|
||||
class ResponseFormatType(Enum):
|
||||
json = "json"
|
||||
grammar = "grammar"
|
||||
|
||||
|
||||
class JsonResponseFormat(BaseModel):
|
||||
type: Literal["json"] = "json"
|
||||
type: Literal[ResponseFormat.json.value] = ResponseFormat.json.value
|
||||
schema: Dict[str, Any]
|
||||
|
||||
|
||||
class GrammarResponseFormat(BaseModel):
|
||||
type: Literal["grammar"] = "grammar"
|
||||
type: Literal[ResponseFormat.grammar.value] = ResponseFormat.grammar.value
|
||||
bnf: Dict[str, Any]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue