Skip to content

Commit

Permalink
seed-and-response-format
Browse files Browse the repository at this point in the history
  • Loading branch information
dobricaskolnik-qc committed Jan 20, 2025
1 parent c78bb45 commit 76717aa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/autoblocks/__snapshots__/test_prompts_autogenerate.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
presence_penalty: Union[float, int] = pydantic.Field(..., alias="presencePenalty")
temperature: Union[float, int] = pydantic.Field(..., alias="temperature")
top_p: Union[float, int] = pydantic.Field(..., alias="topP")
seed: Union[float, int] = pydantic.Field(..., alias="seed")
response_format: Dict[str, Any] = pydantic.Field(..., alias="responseFormat")


class PromptATemplateRenderer(TemplateRenderer):
Expand Down Expand Up @@ -92,6 +94,8 @@
presence_penalty: Union[float, int] = pydantic.Field(..., alias="presencePenalty")
temperature: Union[float, int] = pydantic.Field(..., alias="temperature")
top_p: Union[float, int] = pydantic.Field(..., alias="topP")
seed: Union[float, int] = pydantic.Field(..., alias="seed")
response_format: Dict[str, Any] = pydantic.Field(..., alias="responseFormat")


class PromptBTemplateRenderer(TemplateRenderer):
Expand Down
4 changes: 4 additions & 0 deletions tests/autoblocks/test_prompts_autogenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def test_write(httpx_mock, snapshot):
"stopSequences": [],
"temperature": 0.7,
"topP": 1,
"seed": 4096,
"responseFormat": {"type": "json_object"},
},
"version": "1.0",
},
Expand Down Expand Up @@ -212,6 +214,8 @@ def test_write(httpx_mock, snapshot):
"stopSequences": [],
"temperature": 0.7,
"topP": 1,
"seed": 4096,
"responseFormat": {"type": "json_schema"},
},
},
"templates": [
Expand Down
6 changes: 6 additions & 0 deletions tests/e2e/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class QuestionAnswererParams(FrozenModel):
presence_penalty: Union[float, int] = pydantic.Field(..., alias="presencePenalty")
max_tokens: Union[float, int] = pydantic.Field(..., alias="maxTokens")
model: str = pydantic.Field(..., alias="model")
seed: Union[float, int] = pydantic.Field(..., alias="seed")
response_format: Dict[str, Any] = pydantic.Field(..., alias="responseFormat")


class QuestionAnswererTemplateRenderer(TemplateRenderer):
Expand Down Expand Up @@ -95,6 +97,8 @@ class TextSummarizationParams(FrozenModel):
presence_penalty: Union[float, int] = pydantic.Field(..., alias="presencePenalty")
max_tokens: Union[float, int] = pydantic.Field(..., alias="maxTokens")
model: str = pydantic.Field(..., alias="model")
seed: Union[float, int] = pydantic.Field(..., alias="seed")
response_format: Dict[str, Any] = pydantic.Field(..., alias="responseFormat")


class TextSummarizationTemplateRenderer(TemplateRenderer):
Expand Down Expand Up @@ -179,6 +183,8 @@ class UsedByCiDontDeleteParams(FrozenModel):
top_k: Union[float, int] = pydantic.Field(..., alias="topK")
max_tokens: Union[float, int] = pydantic.Field(..., alias="maxTokens")
model: str = pydantic.Field(..., alias="model")
seed: Union[float, int] = pydantic.Field(..., alias="seed")
response_format: Dict[str, Any] = pydantic.Field(..., alias="responseFormat")


class UsedByCiDontDeleteTemplateRenderer(TemplateRenderer):
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ def test_prompt_manager():
assert ctx.params.temperature == 0.3
assert ctx.params.top_p == 1
assert ctx.params.top_k == 0
assert ctx.params.seed == 4096
assert ctx.params.response_format == {"type": "json_object"}

assert (
ctx.render_template.template_a(
Expand Down Expand Up @@ -260,6 +262,8 @@ def test_prompt_manager():
"temperature": 0.3,
"topK": 0,
"topP": 1,
"seed": 4096,
"responseFormat": {"type": "json_object"},
},
},
"templates": [
Expand Down Expand Up @@ -291,6 +295,8 @@ def test_prompt_manager_latest():
assert ctx.params.temperature == 0.3
assert ctx.params.top_p == 1
assert ctx.params.top_k == 0
assert ctx.params.seed == 4096
assert ctx.params.response_format == {"type": "json_object"}

assert (
ctx.render_template.template_a(
Expand Down Expand Up @@ -321,6 +327,8 @@ def test_prompt_manager_latest():
"temperature": 0.3,
"topK": 0,
"topP": 1,
"seed": 4096,
"responseFormat": {"type": "json_object"},
},
},
"templates": [
Expand Down

0 comments on commit 76717aa

Please sign in to comment.