diff --git a/packages/core/src/prompty.ts b/packages/core/src/prompty.ts index 0c0a9d1717..daee26b4c5 100644 --- a/packages/core/src/prompty.ts +++ b/packages/core/src/prompty.ts @@ -86,9 +86,19 @@ function promptyFrontmatterToMeta(frontmatter: PromptyFrontmatter): PromptArgs { if (modelParameters?.n > 1) throw new Error("multi-turn not supported") if (modelParameters?.tools?.length) throw new Error("streaming not supported") - if (configuration?.azure_deployment) + + // resolve model + if ( + configuration?.type === "azure_openai" || + configuration?.type === "azure" + ) { + if (!configuration.azure_deployment) + throw new Error("azure_deployment required") modelName = `azure:${configuration.azure_deployment}` - else if (configuration?.type) modelName = `openai:${configuration.type}` + } else if (configuration?.type === "azure_serverless") { + throw new Error("azure_serverless not supported") + } else if (configuration?.type === "openai") + modelName = `openai:${configuration.type}` const meta = deleteUndefinedValues({ model: modelName, diff --git a/packages/sample/src/weatherforecastdesc.prompty b/packages/sample/src/weatherforecastdesc.prompty new file mode 100644 index 0000000000..387c7d9d73 --- /dev/null +++ b/packages/sample/src/weatherforecastdesc.prompty @@ -0,0 +1,35 @@ +--- +name: generate_weather_detailed_description +description: A prompt that generated a detaled description for a weather forecast +authors: + - Bruno Capuano +model: + api: chat + configuration: + type: azure_openai + azure_endpoint: ${env:AZURE_OPENAI_ENDPOINT} + azure_deployment: ${env:AZURE_OPENAI_MODEL} + parameters: + max_tokens: 3000 +sample: + today: > + 2024-07-16 + + date: > + 2024-07-17 + + forecastTemperatureC: > + 25°C +--- + +# System: +You are an AI assistant who generated detailed weather forecast descriptions. The detailed description is a paragraph long. +You use the full description of the date, including the weekday. +You also give a reference to the forecast compared to the current date today. +As the assistant, you generate descriptions using a funny style and even add some personal flair with appropriate emojis. + +# Context +Use the following context to generated a detailed weather forecast descriptions +- Today: {{today}} +- Date: {{date}} +- TemperatureC: {{forecastTemperatureC}} \ No newline at end of file