mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 12:07:34 +00:00
rename toolchain/ --> llama_toolchain/
This commit is contained in:
parent
d95f5f863d
commit
f9111652ef
73 changed files with 36 additions and 37 deletions
|
@ -0,0 +1,2 @@
|
|||
from .datatypes import * # noqa: F401 F403
|
||||
from .endpoints import * # noqa: F401 F403
|
12
llama_toolchain/synthetic_data_generation/api/datatypes.py
Normal file
12
llama_toolchain/synthetic_data_generation/api/datatypes.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class FilteringFunction(Enum):
|
||||
"""The type of filtering function."""
|
||||
|
||||
none = "none"
|
||||
random = "random"
|
||||
top_k = "top_k"
|
||||
top_p = "top_p"
|
||||
top_k_top_p = "top_k_top_p"
|
||||
sigmoid = "sigmoid"
|
35
llama_toolchain/synthetic_data_generation/api/endpoints.py
Normal file
35
llama_toolchain/synthetic_data_generation/api/endpoints.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
from typing import Any, Dict, List, Optional, Protocol
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from pyopenapi import webmethod
|
||||
from strong_typing.schema import json_schema_type
|
||||
|
||||
from llama_models.llama3_1.api.datatypes import * # noqa: F403
|
||||
from llama_toolchain.reward_scoring.api.datatypes import * # noqa: F403
|
||||
from .datatypes import * # noqa: F403
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class SyntheticDataGenerationRequest(BaseModel):
|
||||
"""Request to generate synthetic data. A small batch of prompts and a filtering function"""
|
||||
|
||||
dialogs: List[Message]
|
||||
filtering_function: FilteringFunction = FilteringFunction.none
|
||||
model: Optional[RewardModel] = None
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class SyntheticDataGenerationResponse(BaseModel):
|
||||
"""Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold."""
|
||||
|
||||
synthetic_data: List[ScoredDialogGenerations]
|
||||
statistics: Optional[Dict[str, Any]] = None
|
||||
|
||||
|
||||
class SyntheticDataGeneration(Protocol):
|
||||
@webmethod(route="/synthetic_data_generation/generate")
|
||||
def post_generate(
|
||||
self,
|
||||
request: SyntheticDataGenerationRequest,
|
||||
) -> Union[SyntheticDataGenerationResponse]: ...
|
Loading…
Add table
Add a link
Reference in a new issue