Skip to content

Commit

Permalink
max tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Oct 23, 2023
1 parent 9e5d33a commit 2285dbf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion finetuna.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'finetuna.psm1'

# Version number of this module.
ModuleVersion = '0.9'
ModuleVersion = '1.0'

# Minimum PowerShell version
PowerShellVersion = '7.0'
Expand Down
12 changes: 8 additions & 4 deletions public/Invoke-TuneChat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ function Invoke-TuneChat {
.PARAMETER Model
The model to be used for the chat. Valid options are 'gpt-3.5-turbo-0613', 'babbage-002', and 'davinci-002'.
.PARAMETER MaxTokens
The maximum number of tokens to be returned by the API. Defaults to 256.
.EXAMPLE
Invoke-TuneChat -Message @(@{role='system'; content='You are a helpful assistant.'}, @{role='user'; content='Who won the world series in 2020?'}) -Model 'gpt-3.5-turbo-0613'
Expand All @@ -22,7 +25,8 @@ function Invoke-TuneChat {
param (
[Parameter(ValueFromPipeline)]
[string[]]$Message = @("how's Potato?"),
[string]$Model = $script:currentmodel
[string]$Model = $script:currentmodel,
[int]$MaxTokens = 256
)
begin {
if (-not $Model) {
Expand All @@ -44,14 +48,14 @@ function Invoke-TuneChat {
$body = @{
model = $Model
messages = $jsonmsg
} | ConvertTo-Json

max_tokens = $MaxTokens
}
Write-Verbose "Chatting using model $Model"
# Create a hashtable containing the parameters
$params = @{
Uri = "https://api.openai.com/v1/chat/completions"
Method = "POST"
Body = $body
Body = ($body | ConvertTo-Json)
}

Write-Verbose "Asking: $Message"
Expand Down

0 comments on commit 2285dbf

Please sign in to comment.