Well, I have never used the execute code card so I...
# 🌎general
c
Well, I have never used the execute code card so I have to experiment with it
q
yes, everything is allready in the right place in that download file, and next to it you can see the previous Node version where I tried it with AI Task
c
thank you much, bro
q
when you play around a bit and test it by giving different instructions, the AI Task may also always manage to get the right answers. I tried editing the instructions in several different ways, but you understand chess so you know better
c
but what is the difference between @workflow.variable and {{workflow.variable}}
q
as far as I understand it, nothing
{{workflow.variable}} I think this always works
@workflow.variable and this not in everyplace
in my experience
c
oh, ok
the good thing is that I'm studying javascript right now so I can understand most of the code you gave me
where can i get the api key from
because you've written a comment there
q
I think when you open account there, it's $5 free to try API, and using GPT-4 Turbo is cheap
$0.01 per 1,000 tokens
c
should the api key look like this: sk-ihgernb3084t6yhgbg09873qtg53l
this is an example
q
yes
let me know if you manage to get your chatbot to always give 100% correct answers for chess. I posted my instructions and ideas yesterday in the general thread, don't know if you noticed them all
c
I saw them
I got an error on the first try xD
q
API error, or wrong chess answer
if GPT-4 also gives wrong answers, then I think the only option is to create a Knowledge Base document/table from the right answers, and use that always. After you build it, it's cheaper, faster
c
q
check Logs
bottom left
there you can find the error message
c
There was an error: {"message":"Request failed with status code 404","name":"AxiosError","stack":"AxiosError: Request failed with status code 404\n at jda (https://studio.botpress.cloud/assets/vendor-c0fd300.js:339:969)\n at XMLHttpRequest.d (https://studio.botpress.cloud/assets/vendor-c0fd300.js:339:4132)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http"],"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","authorization":"Bearer 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"},"withCredentials":false,"baseURL":"","method":"post","url":"https://botpress.studio/api/proxy/https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions","data":"{\"model\":\"gpt-4-1106-preview\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a professional chess master, and your task is to determine whether there is a chess opening with the given five moves, and what its name is.\"},{\"role\":\"user\",\"content\":\"Is there a real opening at chess with these moves 1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6. If there is, tell the name of the opening and the variation.\"}],\"temperature\":0,\"max_tokens\":1024,\"top_p\":1,\"frequency_penalty\":0,\"presence_penalty\":0}"},"code":"ERR_BAD_REQUEST","status":404} {"scope":"bot-action","cardId":"card:Determining Chess Opening Name and Variation with Given Moves","nodeId":"node:new_node","workflowId":"flow:Main"}
q
yes, API error, OpenAI is under DDoS attack
c
lol
😂
q
those crooks!
ruining our work and life
c
hahaha
but the constant apiURL = "..." link is taking me to a blank page, is that supposed to happen?
this
q
yes, let me check
that link works if you provide there all the information, API key, model, content
Execute code card does that for you
in here
Copy code
js
const response = await axios.post(apiUrl, data, { headers })
it puts all the data and headers after that apiURL and then it works
c
oh, ok, so there's nothing to change?
q
no, only the API key
c
thank you, bro
q
I tried and now it works in the Emulator
Yes, the moves you've described are part of a well-known chess opening. The opening is called the Ruy Lopez, named after the 16th-century Spanish priest and chess player Ruy López de Segura. The specific variation you've mentioned is known as the Ruy Lopez, Closed Defense. The moves are: e4 e5 Nf3 Nc6 Bb5 a6 Ba4 Nf6 O-O Be7 This is one of the most classical lines in the Ruy Lopez, where Black opts for a solid setup, preparing to castle kingside. The Closed Defense is characterized by the move 5...Be7, which is a conservative approach that aims to maintain a strong, flexible pawn structure and develop pieces to natural squares. The game can branch into many different lines from this point, depending on the players' choices.
9 Views