promptgun 0.20.2 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,31 @@
1
1
  # Promptgun
2
2
 
3
- The simplest, most advanced LLM prompting library.
3
+ The simplest, most advanced LLM prompting and agent library.
4
+
5
+ ```typescript
6
+ const restaurants = ai
7
+ .chat("Recommend 3 restaurants in Paris perfect for today's weather")
8
+ .tools(
9
+ defineTool({
10
+ name: 'get-weather',
11
+ parameters: spec => spec.string(),
12
+ function: async location => {
13
+ const response = await fetch(`https://api.weather.com/v1/current?location=${location}`)
14
+ return response.json()
15
+ }
16
+ })
17
+ )
18
+ .getArray(spec => spec.object(o => o
19
+ .hasString('name')
20
+ .hasString('cuisine')
21
+ .hasString('weatherReason', 'Why this restaurant fits today\'s weather')
22
+ ))
23
+
24
+ // Process each restaurant as it streams in
25
+ for await (const restaurant of restaurants) {
26
+ console.log(`${restaurant.name} (${restaurant.cuisine}): ${restaurant.weatherReason}`)
27
+ }
28
+ ```
4
29
 
5
30
  # How to use
6
31
  ### Data output - streamed
package/build/index.d.ts CHANGED
@@ -953,6 +953,7 @@ export declare const AiModel: {
953
953
  */
954
954
  readonly omni_moderation_2024_09_26: "omni-moderation-2024-09-26";
955
955
  /**
956
+ * "OpenAI model ID: omni-moderation-latest"
956
957
  * | Attribute | Rating | Value |
957
958
  * |----------------|-----------------|----------------|
958
959
  * | Intelligence | ○○○ | Moderate |
@@ -1086,7 +1087,7 @@ export declare type DeepPartial<T> = T extends object ? {
1086
1087
 
1087
1088
  export declare function defineTool<T>(config: {
1088
1089
  name: string;
1089
- description: string;
1090
+ description?: string;
1090
1091
  parameters: (spec: EmptyTypeSpec<unknown>) => TypeSpec<T>;
1091
1092
  function: ToolFunction<T>;
1092
1093
  }): ToolDefinition<T>;
@@ -1485,7 +1486,7 @@ export declare enum TokenType {
1485
1486
 
1486
1487
  export declare type ToolDefinition<T = any> = {
1487
1488
  name: string;
1488
- description: string;
1489
+ description?: string;
1489
1490
  parameters: TypeSpec<T>;
1490
1491
  function: ToolFunction<T>;
1491
1492
  };