Script Library: 1240 scripts


REBOL [ title: "Gateway for request to AI" File: %ai-geteway.r Date: 30-06-2024 Version: 0.0.1 Author: "Sergey Pochinok" Purpose: "A function that makes an AI request via the Internet and returns a response." EMail: [%pochinok--bk--ru] History: [ 0.0.1 [30-06-2024 "Started"] 0.0.2 [10-07-2024 "The update includes two new AI models"] ] Category: [info] library: [ level: 'intermediate platform: 'all type: 'function domain: [ai text text-processing internet] tested-under: [core & view win & linux] support: none license: 'BSD see-also: none ] ] ai: func [ "Text request to AI. Default uses Phind model" request [string!] "request text" /blackboxai "uses BlackBox model" /koboldai "uses koboldcpp/HF_SPACE_Tiefighter-13B" ] [ if all [blackboxai koboldai] [return "ERROR! Using both parameters at the same time will result in a conflict."] url: copy if blackboxai [url: copy] if koboldai [url: copy] return first parse/all read/custom url reduce ['post append copy "q=" request] "^(null)" ] ; simple example of using the function print ai "Hi. Tell us about yourself and the Rebol language" halt
halt ;; to terminate script if DO'ne from webpage
<< age.r · ai.r >>
  • ai-geteway.r has documentation.
  • email address(es) have been munged to protect them from spam harvesters. If you are a Library member, you can log on and view this script without the munging.
  • (pochinok:bk:ru)