|
3 | 3 |
|
4 | 4 | from pydantic import TypeAdapter |
5 | 5 |
|
| 6 | +from guidance._schema import SamplingParams |
| 7 | + |
6 | 8 | from .._ast import ( |
7 | 9 | JsonNode, |
8 | 10 | ) |
@@ -85,6 +87,7 @@ def create_azure_openai_model( |
85 | 87 | azure_ad_token_provider: Optional[Callable[[], str]] = None, |
86 | 88 | has_audio_support: bool = False, |
87 | 89 | has_image_support: bool = False, |
| 90 | + sampling_params: Optional[SamplingParams] = None, |
88 | 91 | **kwargs, |
89 | 92 | ) -> Model: |
90 | 93 | """Create a Model capable of interacting with an Azure AI OpenAI deployment |
@@ -143,7 +146,11 @@ def create_azure_openai_model( |
143 | 146 | **kwargs, |
144 | 147 | ) |
145 | 148 |
|
146 | | - model = Model(interpreter=interpreter, echo=echo) |
| 149 | + model = Model( |
| 150 | + interpreter=interpreter, |
| 151 | + echo=echo, |
| 152 | + sampling_params=SamplingParams() if sampling_params is None else sampling_params, |
| 153 | + ) |
147 | 154 |
|
148 | 155 | return model |
149 | 156 |
|
@@ -216,6 +223,7 @@ def create_azure_aifoundry_model( |
216 | 223 | model_name: str, |
217 | 224 | api_key: Optional[str] = None, |
218 | 225 | token_credential: Optional["TokenCredential"] = None, |
| 226 | + sampling_params: Optional[SamplingParams] = None, |
219 | 227 | ) -> Model: |
220 | 228 | """Create a Model capable of interacting with an Azure AI OpenAI deployment |
221 | 229 |
|
@@ -257,5 +265,9 @@ def create_azure_aifoundry_model( |
257 | 265 | model_name=model_name, |
258 | 266 | ) |
259 | 267 |
|
260 | | - result = Model(interpreter=interpreter, echo=echo) |
| 268 | + result = Model( |
| 269 | + interpreter=interpreter, |
| 270 | + echo=echo, |
| 271 | + sampling_params=SamplingParams() if sampling_params is None else sampling_params, |
| 272 | + ) |
261 | 273 | return result |
0 commit comments