Skip to content
This repository has been archived by the owner. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lazyshell.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ __lzsh_llm_api_call() {

local response_file=$(mktemp)

local escaped_prompt=$(echo "$prompt" | jq -R -s '.')
local escaped_intro=$(echo "$intro" | jq -R -s '.')
local data='{"messages":[{"role": "system", "content": '"$escaped_intro"'},{"role": "user", "content": '"$escaped_prompt"'}],"model":"gpt-3.5-turbo","max_tokens":256,"temperature":0}'
# Set the model. Defaults to gpt-3.5-turbo if $GPT_MODEL is not set.
local gpt_model=${GPT_MODEL:-"gpt-3.5-turbo"}

local escaped_prompt=$(echo "$prompt" | jq -aRs .)
local escaped_intro=$(echo "$intro" | jq -aRs .)
local data="{\"messages\":[{\"role\": \"system\", \"content\": $escaped_intro},{\"role\": \"user\", \"content\": $escaped_prompt}],\"model\":\"$gpt_model\",\"max_tokens\":256,\"temperature\":0}"

# Read the response from file
# Todo: avoid using temp files
Expand Down