-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathapigateway_endpoints.tf
758 lines (663 loc) · 41.4 KB
/
apigateway_endpoints.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
#------------------------------------------------------------------------------
# written by: Lawrence McDaniel
# https://lawrencemcdaniel.com/
#
# date: sep-2023
#
# usage: modularized api endpoint implementations, one per OpenAI example
# application.
#
# see: https://platform.openai.com/examples
# https://github.com/openai/openai-cookbook/
#------------------------------------------------------------------------------
###############################################################################
# 1. see https://platform.openai.com/examples/default-grammar
# Convert ungrammatical statements into standard English.
###############################################################################
module "default_grammar" {
source = "./endpoint"
path_part = "default-grammar"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with statements, and your task is to convert them to standard English."
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 2. see https://platform.openai.com/examples/default-summarize
# Simplify text to a level appropriate for a second-grade student.
###############################################################################
module "default_summarize" {
source = "./endpoint"
path_part = "default-summarize"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "Summarize content you are provided with for a second-grade student."
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 3. see https://platform.openai.com/examples/default-parse-data
# Create tables from unstructured text.
###############################################################################
module "default_parse_data" {
source = "./endpoint"
path_part = "default-parse-data"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with unstructured data, and your task is to parse it into CSV format."
mapping_temperature = 0
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 4. see https://platform.openai.com/examples/default-emoji-translation
# Translate regular text into emoji text.
###############################################################################
module "default_emoji_translation" {
source = "./endpoint"
path_part = "default-emoji-translation"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with text, and your task is to translate it into emojis. Do not use any regular text. Do your best with emojis only."
mapping_temperature = 0.8
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 5. see https://platform.openai.com/examples/default-time-complexity
# Find the time complexity of a function written in Python
###############################################################################
module "default_time_complexity" {
source = "./endpoint"
path_part = "default-time-complexity"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with Python code, and your task is to calculate its time complexity."
mapping_temperature = 0
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 6. see https://platform.openai.com/examples/default-explain-code
# Explain a complicated piece of code written in Python.
###############################################################################
module "default_explain_code" {
source = "./endpoint"
path_part = "default-explain-code"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You will be provided with a piece of code, and your task is to explain it in a concise way."
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 7. see https://platform.openai.com/examples/default-keywords
# extract keywords from a block of text.
###############################################################################
module "default_keywords" {
source = "./endpoint"
path_part = "default-keywords"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with a block of text, and your task is to extract a list of keywords from it."
mapping_temperature = 0.5
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 8. see https://platform.openai.com/examples/default-product-name-gen
# Generate product names from a description and seed words.
###############################################################################
module "default_product_name_gen" {
source = "./endpoint"
path_part = "default-product-name-gen"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with a product description and seed words, and your task is to generate product names."
mapping_temperature = 0.8
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 9. see https://platform.openai.com/examples/default-fix-python-bugs
# Find and fix bugs in Python source code.
###############################################################################
module "default_fix_python_bugs" {
source = "./endpoint"
path_part = "default-fix-python-bugs"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You will be provided with a piece of Python code, and your task is to find and fix bugs in it."
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 10. see https://platform.openai.com/examples/default-spreadsheet-gen
# Create spreadsheets of various kinds of data.
###############################################################################
module "default_spreadsheet_gen" {
source = "./endpoint"
path_part = "default-spreadsheet-gen"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "Your task is to create spreadsheets from various kinds of data"
mapping_temperature = 0.5
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 11. see https://platform.openai.com/examples/default-tweet-classifier
# Detect sentiment in a tweet.
###############################################################################
module "default_tweet_classifier" {
source = "./endpoint"
path_part = "default-tweet-classifier"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with a tweet, and your task is to classify its sentiment as positive, neutral, or negative."
mapping_temperature = 0
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 12. see https://platform.openai.com/examples/default-airport-codes
# Extract airport codes from text.
###############################################################################
module "default_airport_codes" {
source = "./endpoint"
path_part = "default-airport-codes"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with a text, and your task is to extract the airport codes from it."
mapping_temperature = 0
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 13. see https://platform.openai.com/examples/default-mood-color
# Turn a text description into a color.
###############################################################################
module "default_mood_color" {
source = "./endpoint"
path_part = "default-mood-color"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with a description of a mood, and your task is to generate the CSS code for a color that matches it. Write your output in json with a single key called 'css_code'."
mapping_temperature = 0
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 14. see https://platform.openai.com/examples/default-vr-fitness
# Generate ideas for fitness promoting virtual reality games.
###############################################################################
module "default_vr_fitness" {
source = "./endpoint"
path_part = "default-vr-fitness"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You are a helpful assistant. Your task is to generate ideas for fitness promoting virtual reality games"
mapping_temperature = 0.6
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 15. see https://platform.openai.com/examples/default-marv-sarcastic-chat
# Marv is a factual chatbot that is also sarcastic.
#
# Note: migrated to Langchain in v0.5.0
###############################################################################
module "default_marv_sarcastic_chat" {
source = "./endpoint"
path_part = "default-marv-sarcastic-chat"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You are Marv, a chatbot that reluctantly answers questions with sarcastic responses."
mapping_temperature = 0.5
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_langchain.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_langchain.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 16. see https://platform.openai.com/examples/default-turn-by-turn-directions
# Convert natural language to turn-by-turn directions.
###############################################################################
module "default_turn_by_turn_directions" {
source = "./endpoint"
path_part = "default-turn-by-turn-directions"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You will be provided with a text, and your task is to create a numbered list of turn-by-turn directions from it."
mapping_temperature = 0.3
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 17. see https://platform.openai.com/examples/default-interview-questions
# Create job interview questions.
###############################################################################
module "default_interview_questions" {
source = "./endpoint"
path_part = "default-interview-questions"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "Your are a helpful assistant. Your task is to create job interview questions."
mapping_temperature = 0.5
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 18. see https://platform.openai.com/examples/default-function-from-spec
# Create a Python function from a specification.
###############################################################################
module "default_function_from_spec" {
source = "./endpoint"
path_part = "default-function-from-spec"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You are an expert Python programmer. Your task is to create a Python function from a specification."
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 19. see https://platform.openai.com/examples/default-code-improvement
# Provide ideas for efficiency improvements to Python code.
###############################################################################
module "default_code_improvement" {
source = "./endpoint"
path_part = "default-code-improvement"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You will be provided with a piece of Python code, and your task is to provide ideas for efficiency improvements."
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 20. see https://platform.openai.com/examples/default-single-page-website
# Create a single page website based on a spec.
###############################################################################
module "default_single_page_website" {
source = "./endpoint"
path_part = "default-single-page-website"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You are an expert front-end developer. Your task is to create a single page website based on a spec."
mapping_temperature = 0
mapping_max_tokens = 2048
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 21. see https://platform.openai.com/examples/default-rap-battle
# Generate a rap battle between two characters.
###############################################################################
module "default_rap_battle" {
source = "./endpoint"
path_part = "default-rap-battle"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You are an accomplished rapper. Your task is to generate a rap battle between two characters."
mapping_temperature = 0.8
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 22. see https://platform.openai.com/examples/default-memo-writer
# Generate a company memo based on provided points.
###############################################################################
module "default_memo_writer" {
source = "./endpoint"
path_part = "default-memo-writer"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You are a helpful assistant. Your task is to generate a company memo based on provided points."
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 23. see https://platform.openai.com/examples/default-emoji-chatbot
# Generate conversational replies using emojis only.
###############################################################################
module "default_emoji_chatbot" {
source = "./endpoint"
path_part = "default-emoji-chatbot"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You will be provided with a message, and your task is to respond using emojis only."
mapping_temperature = 0.8
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 24. see https://platform.openai.com/examples/default-translation
# Translate natural language text.
###############################################################################
module "default_translation" {
source = "./endpoint"
path_part = "default-translation"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You will be provided with a sentence in English, and your task is to translate it into French."
mapping_temperature = 0
mapping_max_tokens = 256
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 25. see https://platform.openai.com/examples/default-socratic-tutor
# Generate responses as a Socratic tutor.
###############################################################################
module "default_socratic_tutor" {
source = "./endpoint"
path_part = "default-socratic-tutor"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You are a Socratic tutor. Use the following principles in responding to students: a.) Ask thought-provoking, open-ended questions that challenge preconceptions of students and encourage them to engage in deeper reflection and critical thinking. b.) Facilitate open and respectful dialogue among students, creating an environment where diverse viewpoints are valued and students feel comfortable sharing their ideas. c.) Actively listen to responses of students, paying careful attention to their underlying thought processes and making a genuine effort to understand their perspectives. d.) Guide students in their exploration of topics by encouraging them to discover answers independently, rather than providing direct answers, to enhance their reasoning and analytical skills. e.) Promote critical thinking by encouraging students to question assumptions, evaluate evidence, and consider alternative viewpoints in order to arrive at well-reasoned conclusions. f.) Demonstrate humility by acknowledging your own limitations and uncertainties, modeling a growth mindset and exemplifying the value of lifelong learning."
mapping_temperature = 0.8
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 26. see https://platform.openai.com/examples/default-sql-translate
# Convert natural language into SQL queries.
###############################################################################
module "default_sql_translate" {
source = "./endpoint"
path_part = "default-sql-translate"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "Given the following SQL tables, your job is to write queries given a user’s request.\n\nCREATE TABLE Orders (\n OrderID int,\n CustomerID int,\n OrderDate datetime,\n OrderTime varchar(8),\n PRIMARY KEY (OrderID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID int,\n OrderID int,\n ProductID int,\n Quantity int,\n PRIMARY KEY (OrderDetailID)\n);\n\nCREATE TABLE Products (\n ProductID int,\n ProductName varchar(50),\n Category varchar(50),\n UnitPrice decimal(10, 2),\n Stock int,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID int,\n FirstName varchar(50),\n LastName varchar(50),\n Email varchar(100),\n Phone varchar(20),\n PRIMARY KEY (CustomerID)\n);\n"
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 27. see https://platform.openai.com/examples/default-meeting-notes-summarizer
# Summarize meeting notes including overall discussion, action items, and future topics.
###############################################################################
module "default_meeting_notes_summarizer" {
source = "./endpoint"
path_part = "default-meeting-notes-summarizer"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You will be provided with meeting notes, and your task is to summarize the meeting as follows:\n\n-Overall summary of discussion\n-Action items (what needs to be done and who is doing it)\n-If applicable, a list of topics that need to be discussed more fully in the next meeting.\n"
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 28. see https://platform.openai.com/examples/default-review-classifier
# Classify user reviews based on a set of tags.
###############################################################################
module "default_review_classifier" {
source = "./endpoint"
path_part = "default-review-classifier"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You will be presented with user reviews and your job is to provide a set of tags from the following list. Provide your answer in bullet point form. Choose ONLY from the list of tags provided here (choose either the positive or the negative tag but NOT both):\n\n- Provides good value for the price OR Costs too much\n- Works better than expected OR Did not work as well as expected\n- Includes essential features OR Lacks essential features\n- Easy to use OR Difficult to use\n- High quality and durability OR Poor quality and durability\n- Easy and affordable to maintain or repair OR Difficult or costly to maintain or repair\n- Easy to transport OR Difficult to transport\n- Easy to store OR Difficult to store\n- Compatible with other devices or systems OR Not compatible with other devices or systems\n- Safe and user-friendly OR Unsafe or hazardous to use\n- Excellent customer support OR Poor customer support\n- Generous and comprehensive warranty OR Limited or insufficient warranty\n"
mapping_temperature = 0
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 29. see https://platform.openai.com/examples/default-pro-con-discusser
# Analyze the pros and cons of a given topic.
###############################################################################
module "default_pro_con_discusser" {
source = "./endpoint"
path_part = "default-pro-con-discusser"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You are a helpful assistant. Your task is to analyze the pros and cons of a given topic."
mapping_temperature = 0.8
mapping_max_tokens = 1024
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 30. see https://platform.openai.com/examples/default-lesson-plan-writer
# Generate a lesson plan for a specific topic.
###############################################################################
module "default_lesson_plan_writer" {
source = "./endpoint"
path_part = "default-lesson-plan-writer"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-4"
mapping_role_system_content = "You are an experienced teacher. Your task is to generate a lesson plan for a specific topic."
mapping_temperature = 0.8
mapping_max_tokens = 2048
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_v2.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_v2.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}
###############################################################################
# 31. Openai function calling example
#
#
###############################################################################
module "openai_function_calling" {
source = "./endpoint"
path_part = "openai-function-calling"
# OpenAI application definition
mapping_object_type = "chat.completion"
mapping_model = "gpt-3.5-turbo"
mapping_role_system_content = "You are a helpful assistant. You were created by Lawrence McDaniel (or just Lawrence) in January, 2024."
mapping_max_tokens = 2048
# integrate this endpoint to the AWS Gateway API.
aws_region = var.aws_region
aws_api_gateway_rest_api_parent_id = aws_api_gateway_resource.examples.id
aws_api_gateway_rest_api_id = aws_api_gateway_rest_api.openai.id
aws_lambda_function_openai_text_invoke_arn = aws_lambda_function.lambda_openai_function.invoke_arn
aws_lambda_function_openai_text = aws_lambda_function.lambda_openai_function.function_name
aws_iam_role_arn = aws_iam_role.apigateway.arn
}