OSR-AI
AI service prompter
Installation
npm i -g @plastichub/osr-ai
- create a file with your OpenAI key, in
C:\\Users\\TeleTubbie\\.config\\osr\\config.json
, with the following content
{
"openai": {
"see":"https://platform.openai.com/api-keys"
"key": "some katbotisch key"
}
}
Examples
Describe the content of a file
osr-ai chatgpt prompt --source=tests/chatgpt/pipe.txt --query="whats in here, add a link to their homepage, check it and add a summary of their activities, as markdown table"
Or
cat tests/chatgpt/pipe.txt | osr-ai chatgpt prompt --query="whats in here, add a link to their homepage, check it and add a summary of their activities, as markdown table"
whereby pipe.txt contains
abb
bigtree
cead
cidepa
kuga
motovario
nagami
siemens
teknic
Output
Company | Homepage | Summary |
---|---|---|
abb | Homepage | ABB is a leading global technology company. They focus on electrification, robotics, and automation solutions. |
bigtree | Homepage | Bigtree is a software development company specializing in web and mobile applications. |
cead | Homepage | CEAD is a company that specializes in 3D printing and additive manufacturing solutions. |
cidepa | Homepage | Cidepa is a manufacturer of industrial machinery and equipment. |
kuga | Homepage | Kuga is an automotive company that designs and manufactures electric vehicles. |
motovario | Homepage | Motovario is a global manufacturer of power transmission and motion control solutions. |
nagami | Homepage | Nagami is a design studio specializing in computational design and digital fabrication. |
siemens | Homepage | Siemens is a multinational conglomerate that provides a wide range of products and services in various industries. |
teknic | Homepage | Teknic is a manufacturer of high-performance motion control products. |
Example, transform code
osr-ai chatgpt prompt --source="./tests/chatgpt/constants.ts" --query="rewrite this enum as object literal,add a function to retrieve a coordinate by name" --model=gpt-4 --debug
whereby ./tests/chatgpt/constants.ts
contains
export enum SpainCities {
Madrid = "40.4168,-3.7038,12",
Barcelona = "41.3851,2.1734,12",
Valencia = "39.4699,-0.3763,12",
Seville = "37.3891,-5.9845,12",
Malaga = "36.7213,-4.4214,12",
Bilbao = "43.2630,-2.9340,12",
Alicante = "38.3452,-0.4810,12",
Zaragoza = "41.6488,-0.8891,12",
Palma = "39.5696,2.6502,12",
Murcia = "37.9922,-1.1307,12",
Granada = "37.1773,-3.5986,12",
Cordoba = "37.8882,-4.7794,12",
Valladolid = "41.6520,-4.7286,12",
Vigo = "42.2406,-8.7207,12",
Gijon = "43.5322,-5.6611,12",
Lleida = "41.6176,0.6200,12",
Tarragona = "41.1189,1.2445,12",
Cadiz = "36.5297,-6.2924,12",
Almeria = "36.8340,-2.4637,12",
Oviedo = "43.3614,-5.8593,12",
Badajoz = "38.8794,-6.9706,12",
Santander = "43.4623,-3.8090,12",
Logrono = "42.4627,-2.4441,12",
Salamanca = "40.9701,-5.6635,12",
Pamplona = "42.8125,-1.6458,12",
}
Output
export const BarcelonaTowns = {
Barcelona: "41.3850639,2.1734035",
Badalona: "41.453966,2.24487",
"L'HospitaletDeLlobregat": "41.3618046,2.0977132",
Terrassa: "41.5654824,2.0109316",
Sabadell: "41.5441063,2.1068342",
Mataro: "41.540977,2.4440367",
SantaColomaDeGramenet: "41.4679772,2.2081475",
CornellaDeLlobregat: "41.3666298,2.0971758",
SantCugatDelValles: "41.4888889,2.1019444",
Castelldefels: "41.2755556,1.995",
CerdanyolaDelValles: "41.4913889,2.1169444",
Granollers: "41.6072222,2.2686111",
VilanovaIGeltru: "41.2155556,1.7383333",
Viladecans: "41.3163889,2.0052778",
ElPratDeLlobregat: "41.2971628,2.0700942",
MolletDelValles: "41.5272964,2.1870736",
Gava: "41.3166667,2.0666667",
SantBoiDeLlobregat: "41.3669444,2.0569444",
}
Example, transcribe an audio file, to text
osr-ai chatgpt transcribe --debug --source="./tests/chatgpt/real.mp3" --dst="./tests/chatgpt/real.txt"
Todos :)
ChatGPT
- [x] model select
- [ ] loaders
- [ ] language system defaults
- [ ] output templates
- [ ] auto-functions, eg "create file , ... "
- [ ] support Urls, for source, and stdin
OSR Todos
- [ ] Loader (mime/glob) -> storage (mem, mongo,...) -> query -> cache
- [ ] session cache (chat history replay)