promptgun 0.20.1 → 0.20.3

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
@@ -1086,7 +1086,7 @@ export declare type DeepPartial<T> = T extends object ? {
1086
1086
 
1087
1087
  export declare function defineTool<T>(config: {
1088
1088
  name: string;
1089
- description: string;
1089
+ description?: string;
1090
1090
  parameters: (spec: EmptyTypeSpec<unknown>) => TypeSpec<T>;
1091
1091
  function: ToolFunction<T>;
1092
1092
  }): ToolDefinition<T>;
@@ -1485,7 +1485,7 @@ export declare enum TokenType {
1485
1485
 
1486
1486
  export declare type ToolDefinition<T = any> = {
1487
1487
  name: string;
1488
- description: string;
1488
+ description?: string;
1489
1489
  parameters: TypeSpec<T>;
1490
1490
  function: ToolFunction<T>;
1491
1491
  };