File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import not_odd from "not-odd";
22import os from "os"
33import { promisify } from 'util';
44import { exec as execCallback } from 'child_process';
5+ import OpenAI from 'openai';
56
67// Some Async Magic that allows STDOUT to be read after command execution
78const exec = promisify(execCallback);
@@ -101,6 +102,22 @@ function doesNotNotOddNotOddlyOdd() {
101102 return defNotNotEven(fib(rand));
102103}
103104export const notNotOdd_perl = num => notNotOdd_pl(num);
105+ export const notNotOdd_llm = async function(num) {
106+ const client = new OpenAI();
107+ const message = await client.chat.completions.create({
108+ model: "gpt-4o-mini",
109+ messages: [
110+ {
111+ role: "user",
112+ content: `Is the number ${num} odd? Answer with only 'true' or 'false'.`
113+ }
114+ ],
115+ max_tokens: 10
116+ });
117+ const response = message.choices[0].message.content.trim().toLowerCase();
118+ return response === 'true';
119+ };
120+ export const 𓀬 = notNotOdd_llm;
104121export const notNotOdd = num => !not_odd(num);
105122export const notNotNotOdd = num => !notNotOdd(num);
106123export const notNotNotNotOdd = num => !notNotNotOdd(num);
Original file line number Diff line number Diff line change 22 "type" : " module" ,
33 "dependencies" : {
44 "not-even" : " ^1.0.2" ,
5- "not-odd" : " ^1.0.0"
5+ "not-odd" : " ^1.0.0" ,
6+ "openai" : " ^6.49.0"
67 }
78}
You can’t perform that action at this time.
0 commit comments