sozercan / kubectl-ai

✨ Kubectl plugin for OpenAI GPT
MIT License
996 stars 73 forks source link

Error: status code 404 message: Unrecognized request argument supplied: functions #89

Closed vicperdana closed 4 months ago

vicperdana commented 10 months ago

Tried passing the --openai-endpoint --openai-deployment-name --openai-api-key as well as setting env vars resulted in the following error. Triple checked the values and still getting the same error.

⣯ Processing...Error: error, status code: 404, message: Unrecognized request argument supplied: functions

Happy to provide additional info, on a mac installed the package using brew.

Azure Open AI GPT 35 turbo 0301

farcorben commented 9 months ago

same at my site.

MacOS 13.5.2 kubectl-ai v0.0.11 - installed by brew

➜  ~ brew info kubectl-ai                                                                                                                                                                                                                                              
==> sozercan/kubectl-ai/kubectl-ai: stable 0.0.11
kubectl-ai is a kubectl plugin to generate and apply Kubernetes manifests using OpenAI GPT.

/opt/homebrew/Cellar/kubectl-ai/0.0.11 (5 files, 36.2MB) *
  Built from source on 2023-09-15 at 12:16:42
From: https://github.com/sozercan/kubectl-ai/blob/HEAD/kubectl-ai.rb
==> Caveats
This plugin requires an OpenAI key.

OpenAI API Key was provided...

➜  ~ kubectl ai "create a foo namespace" --debug                                                                                                                                                                                                                       (colima/default)
DEBU[0000] openai-endpoint: https://api.openai.com/v1
DEBU[0000] openai-deployment-name: gpt-3.5-turbo-0301
DEBU[0000] azure-openai-map: map[]
DEBU[0000] temperature: 0.000000
DEBU[0000] use-k8s-api: false
DEBU[0000] k8s-openapi-url:
DEBU[0000] prompt: You are a Kubernetes YAML generator, only generate valid Kubernetes YAML manifests. Do not provide any explanations, only generate YAML. create a foo namespace
Error: error, status code: 404, message: Unrecognized request argument supplied: functions
gadkins commented 9 months ago

@vicperdana @farcorben

The issue is that you're using a the default model (gpt-3.5-turbo-0301), which does not include support for function calling. Set the model to use 0613 (or later) via export OPENAI_DEPLOYMENT_NAME=gpt-3.5-turbo-0613.

It's called out in the README here, but it is not very clear.

vicperdana commented 9 months ago

Thanks, I definitely missed this one. Will try again a bit later.

From: Grayson Adkins @.> Date: Thursday, 21 September 2023 at 2:46 pm To: sozercan/kubectl-ai @.> Cc: Mention @.>, Author @.> Subject: Re: [sozercan/kubectl-ai] Error: status code 404 (Issue #89)

@vicperdanahttps://github.com/vicperdana @farcorbenhttps://github.com/farcorben

The issue is that you're using a the default model (gpt-3.5-turbo-0301), which does not include support for function calling. Set the model to use 0613 (or later) via export OPENAI_DEPLOYMENT_NAME=gpt-3.5-turbo-0613.

It's called out in the README herehttps://github.com/sozercan/kubectl-ai#flags-and-environment-variables, but it is not very clear.

— Reply to this email directly, view it on GitHubhttps://github.com/sozercan/kubectl-ai/issues/89#issuecomment-1728785919 or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABWJAUDAHDLGDVJSUG7WG53X3PBB5BFKMF2HI4TJMJ2XIZLTSOBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLLDTOVRGUZLDORPXI6LQMWWES43TOVSUG33NNVSW45FGORXXA2LDOOJIFJDUPFYGLKTSMVYG643JORXXE6NFOZQWY5LFVE3DCNJYHEYTQNRSQKSHI6LQMWSWS43TOVS2K5TBNR2WLKRRHA4TANRVGI2DKNFHORZGSZ3HMVZKMY3SMVQXIZI. You are receiving this email because you were mentioned.

Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

farcorben commented 9 months ago

hi, with export export OPENAI_DEPLOYMENT_NAME=gpt-3.5-turbo-0613 it works at my machine. Thanks!

0GiS0 commented 9 months ago

Hi all!

I'm using Azure Open AI and even using 0613 version of gpt-3.5 turbo It returns 404 :(

⚡➜  kubectl ai "create an nginx deployment with 3 replicas" --debug
DEBU[0000] openai-endpoint: https://francecentral.api.cognitive.microsoft.com/ 
DEBU[0000] openai-deployment-name: gpt-35-turbo-0613    
DEBU[0000] azure-openai-map: map[]                      
DEBU[0000] temperature: 0.000000                        
DEBU[0000] use-k8s-api: false                           
DEBU[0000] k8s-openapi-url:                             
DEBU[0000] prompt: You are a Kubernetes YAML generator, only generate valid Kubernetes YAML manifests. Do not provide any explanations, only generate YAML. create an nginx deployment with 3 replicas 
Error: error, status code: 404, message: Resource not found
image

Any other suggestion?

Thank you so much!!!

sozercan commented 9 months ago

@0GiS0 you are using a wrong endpoint, it must be openai, azure openai (https://resource-name.openai.azure.com), or localai.

for the rest of the issue, as @gadkins pointed out, functions needs a 0613 api version. Easiest solution is to just use a floating model or 0613 version for now. If anyone is interested in contributing, it makes sense to add a check to validate api version.

0GiS0 commented 9 months ago

@0GiS0 you are using a wrong endpoint, it must be openai, azure openai (https://resource-name.openai.azure.com), or localai.

for the rest of the issue, as @gadkins pointed out, functions needs a 0613 api version. Easiest solution is to just use a floating model or 0613 version for now. If anyone is interested in contributing, it makes sense to add a check to validate api version.

Solved!

In the doc It doesn’t specify the --custom-domain parameter! That’s why the endpoints are different. If we want the same endpoint *.openai.azure.com we must specify the parameter like this:

# Create Azure Open AI resource
az cognitiveservices account create \
--kind OpenAI\
--name $AZ_OPEN_AI \
--custom-domain $AZ_OPEN_AI \
--sku S0 \
--resource-group $RESOURCE_GROUP \
--location $LOCATION

And that’s it 😊

sozercan commented 4 months ago

This should be fixed with #110