.NET prompty attribute
adds a [Prompty(File=...)] attribute enabling specifying the prompts file on a class or method
see #205
/// <summary>
/// Prompty Attribute - used to load a prompty file or resource from an attribute
/// </summary>
/// <usage>
/// [Prompty("prompty/basic.prompty"]
/// [Prompty("prompty/embedded-resource-path.prompty", IsResource = true, Configuration = "default", Params = new string[] { "question", "answer" })]
/// public class MyClass
/// {...}
/// in a class or method then use the attribute to load the prompty
/// ...
/// var prompty = (PromptyAttribute)Attribute.GetCustomAttribute(typeof(MyClass), typeof(PromptyAttribute));
/// var messages = prompty.Messages;
/// ...
/// </usage>
Note: you can only specify params that are strings. that is a limitation of attribs. you can still Prepare(new Dictionary<string, object) manually.
please note: Co-Autohored by: @IntrepidIcarus (Dustin Duran)
Are there any issues with file normalization when using a stream? In the python version you can explode out a section of the frontmatter by adding a ${file:my_props.json} to any part of the tree and it will load my_props.json based upon the relative path to the parent prompty file. Does this work the same way?
Are there any issues with file normalization when using a stream? In the python version you can explode out a section of the frontmatter by adding a
${file:my_props.json}to any part of the tree and it will loadmy_props.jsonbased upon the relative path to the parent prompty file. Does this work the same way?
no idea - my assumption is that this would be down to the Json serializer rather than the file IO.