-
Notifications
You must be signed in to change notification settings - Fork 11
/
PSAI.psm1
165 lines (151 loc) · 6.51 KB
/
PSAI.psm1
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
. $PSScriptRoot/Private/Add-OAIToolsToList.ps1
. $PSScriptRoot/Private/ArgumentCompletion.ps1
. $PSScriptRoot/Private/Invoke-OAIBeta.ps1
. $PSScriptRoot/Private/Get-MultipartFormData.ps1
. $PSScriptRoot/Private/Get-ToolProperty.ps1
# Agent Tools
Import-Module $PSScriptRoot/Public/Tools/CalculatorTool.psm1
Import-Module $PSScriptRoot/Public/Tools/TavilyTool.psm1
Import-Module $PSScriptRoot/Public/Tools/StockTickerTool.psm1
Import-Module $PSScriptRoot/Public/Tools/YouTubeTool.psm1
# Agent Assistants
Import-Module $PSScriptRoot/Public/Tools/YouTubeAssistant.psm1
# Public Functions
. $PSScriptRoot/Public/New-Agent.ps1
. $PSScriptRoot/Public/Get-AgentResponse.ps1
. $PSScriptRoot/Public/Invoke-InteractiveCLI.ps1
. $PSScriptRoot/Public/Add-OAIVectorStore.ps1
. $PSScriptRoot/Public/Clear-OAIAllItems.ps1
. $PSScriptRoot/Public/Clear-OAIAssistants.ps1
. $PSScriptRoot/Public/Clear-OAIFiles.ps1
. $PSScriptRoot/Public/ConvertFrom-FunctionDefinition.ps1
. $PSScriptRoot/Public/ConvertFrom-GPTMarkdownTable.ps1
. $PSScriptRoot/Public/ConvertFrom-OAIAssistant.ps1
. $PSScriptRoot/Public/ConvertFrom-UnixTimestamp.ps1
. $PSScriptRoot/Public/ConvertTo-OAIAssistant.ps1
. $PSScriptRoot/Public/ConvertTo-OAIMessage.ps1
. $PSScriptRoot/Public/ConvertTo-OpenAIFunctionSpec.ps1
. $PSScriptRoot/Public/ConvertTo-OpenAIFunctionSpecDataType.ps1
. $PSScriptRoot/Public/ConvertTo-ToolFormat.ps1
. $PSScriptRoot/Public/Copy-OAIAssistant.ps1
. $PSScriptRoot/Public/dumpJson.ps1
. $PSScriptRoot/Public/Enable-AIShortCutKey.ps1
. $PSScriptRoot/Public/Enable-OAICodeInterpreter.ps1
. $PSScriptRoot/Public/Enable-OAIFileSearchTool.ps1
. $PSScriptRoot/Public/Export-OAIAssistant.ps1
. $PSScriptRoot/Public/Format-OAIFunctionCall.ps1
. $PSScriptRoot/Public/Get-AzOAISecrets.ps1
. $PSScriptRoot/Public/Get-FunctionDefinition.ps1
. $PSScriptRoot/Public/Get-OAIAssistant.ps1
. $PSScriptRoot/Public/Get-OAIAssistantItem.ps1
. $PSScriptRoot/Public/Get-OAIFile.ps1
. $PSScriptRoot/Public/Get-OAIFileContent.ps1
. $PSScriptRoot/Public/Get-OAIFileItem.ps1
. $PSScriptRoot/Public/Get-OAIFunctionCallSpec.ps1
. $PSScriptRoot/Public/Get-OAIImageGeneration.ps1
. $PSScriptRoot/Public/Get-OAIMessage.ps1
. $PSScriptRoot/Public/Get-OAIMessageItem.ps1
. $PSScriptRoot/Public/Get-OAIProvider.ps1
. $PSScriptRoot/Public/Get-OAIRun.ps1
. $PSScriptRoot/Public/Get-OAIRunItem.ps1
. $PSScriptRoot/Public/Get-OAIRunStep.ps1
. $PSScriptRoot/Public/Get-OAIRunStepItem.ps1
. $PSScriptRoot/Public/Get-OAIThread.ps1
. $PSScriptRoot/Public/Get-OAIThreadItem.ps1
. $PSScriptRoot/Public/Get-OAIVectorStore.ps1
. $PSScriptRoot/Public/Get-OAIVectorStoreFile.ps1
. $PSScriptRoot/Public/Get-OAIVectorStoreFileBatch.ps1
. $PSScriptRoot/Public/Get-OAIVectorStoreFileItem.ps1
. $PSScriptRoot/Public/Get-OAIVectorStoreFilesInBatch.ps1
. $PSScriptRoot/Public/Get-OAIVectorStoreItem.ps1
. $PSScriptRoot/Public/Get-OpenAISpecDescriptions.ps1
. $PSScriptRoot/Public/Import-OAIAssistant.ps1
. $PSScriptRoot/Public/Invoke-AIExplain.ps1
. $PSScriptRoot/Public/Invoke-AIPrompt.ps1
. $PSScriptRoot/Public/Invoke-FilesToPrompt.ps1
. $PSScriptRoot/Public/Invoke-OAIChat.ps1
. $PSScriptRoot/Public/Invoke-OAIChatCompletion.ps1
. $PSScriptRoot/Public/Invoke-OAIFunctionCall.ps1
. $PSScriptRoot/Public/Invoke-OAIUploadFile.ps1
. $PSScriptRoot/Public/Invoke-QuickChat.ps1
. $PSScriptRoot/Public/Invoke-SimpleQuestion.ps1
. $PSScriptRoot/Public/llm/openai/New-OpenAIChat.ps1
. $PSScriptRoot/Public/New-ChatRequestAssistantMessage.ps1
. $PSScriptRoot/Public/New-ChatRequestSystemMessage.ps1
. $PSScriptRoot/Public/New-ChatRequestToolMessage.ps1
. $PSScriptRoot/Public/New-ChatRequestUserMessage.ps1
. $PSScriptRoot/Public/New-OAIAssistant.ps1
. $PSScriptRoot/Public/New-OAIAssistantWithVectorStore.ps1
. $PSScriptRoot/Public/New-OAIChatMessage.ps1
. $PSScriptRoot/Public/New-OAIMessage.ps1
. $PSScriptRoot/Public/New-OAIRun.ps1
. $PSScriptRoot/Public/New-OAIThread.ps1
. $PSScriptRoot/Public/New-OAIThreadAndRun.ps1
. $PSScriptRoot/Public/New-OAIThreadQuery.ps1
. $PSScriptRoot/Public/New-OAIVectorStore.ps1
. $PSScriptRoot/Public/New-OAIVectorStoreFile.ps1
. $PSScriptRoot/Public/New-OAIVectorStoreFileBatch.ps1
. $PSScriptRoot/Public/Out-OAIMessages.ps1
. $PSScriptRoot/Public/Register-Tool.ps1
. $PSScriptRoot/Public/Remove-OAIAssistant.ps1
. $PSScriptRoot/Public/Remove-OAIFile.ps1
. $PSScriptRoot/Public/Remove-OAIMessage.ps1
. $PSScriptRoot/Public/Remove-OAIThread.ps1
. $PSScriptRoot/Public/Remove-OAIVectorStore.ps1
. $PSScriptRoot/Public/Remove-OAIVectorStoreFile.ps1
. $PSScriptRoot/Public/Reset-OAIProvider.ps1
. $PSScriptRoot/Public/Set-AzOAISecrets.ps1
. $PSScriptRoot/Public/Set-OAIProvider.ps1
. $PSScriptRoot/Public/Show-OAIAPIReferenceWebPage.ps1
. $PSScriptRoot/Public/Show-OAIAssistantWebPage.ps1
. $PSScriptRoot/Public/Show-OAIBilling.ps1
. $PSScriptRoot/Public/Show-OAIPlaygroundWebPage.ps1
. $PSScriptRoot/Public/Show-OAIVectorStoreWebPage.ps1
. $PSScriptRoot/Public/Stop-OAIRun.ps1
. $PSScriptRoot/Public/Stop-OAIVectorStoreFileBatch.ps1
. $PSScriptRoot/Public/Submit-OAIMessage.ps1
. $PSScriptRoot/Public/Submit-OAIToolOutputs.ps1
. $PSScriptRoot/Public/Test-JSONReplacement.ps1
. $PSScriptRoot/Public/Test-LLMModel.ps1
. $PSScriptRoot/Public/Test-OAIAssistantId.ps1
. $PSScriptRoot/Public/UnitTesting.ps1
. $PSScriptRoot/Public/Update-OAIAssistant.ps1
. $PSScriptRoot/Public/Update-OAIMessage.ps1
. $PSScriptRoot/Public/Update-OAIRun.ps1
. $PSScriptRoot/Public/Update-OAIThread.ps1
. $PSScriptRoot/Public/Update-OAIVectorStore.ps1
. $PSScriptRoot/Public/Wait-OAIOnRun.ps1
$script:EnableUnitTesting = $false
$script:InvokeOAIUnitTestingData = $null
$script:OAIProvider = 'OpenAI'
$script:AzOAISecrets = @{
apiURI = $null
apiKEY = $null
apiVersion = $null
deploymentName = $null
}
$script:baseUrl = "https://api.openai.com/v1"
# $script:headers = @{
# 'OpenAI-Beta' = 'assistants=v1'
# 'Authorization' = "Bearer $env:OpenAIKey"
# }
# Aliases
Set-Alias goaia Get-OAIAssistant
Set-Alias roaia Remove-OAIAssistant
Set-Alias noaia New-OAIAssistant
Set-Alias noait New-OAIThread
Set-Alias uoaia Update-OAIAssistant
Set-Alias ai Invoke-OAIChat
$targetTypes = "System.String", "System.Array"
foreach ($targetType in $targetTypes) {
Update-TypeData -TypeName $targetType -MemberType ScriptMethod -MemberName "Chat" -Force -Value {
param($Prompt)
Invoke-AIPrompt -Prompt $Prompt -Data $this
}
}
foreach ($targetType in $targetTypes) {
Update-TypeData -TypeName $targetType -MemberType ScriptMethod -MemberName "PSChat" -Force -Value {
param($Prompt)
Invoke-AIPrompt -Prompt $Prompt -Data $this -UsePowerShellPersona
}
}