Script Library: 1240 scripts
 

ai-geteway.r

REBOL [ title: "Gateway for request to AI" File: %ai-geteway.r Date: 26-08-2024 Version: 0.0.3 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"] 0.0.3 [26-08-2024 "Four AI models were added"] ] Category: [info] library: [ level: 'intermediate platform: 'all type: 'function domain: [ai text text-processing internet] tested-under: [core & view 2.7.8.3.1 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 only, answers from novels" /gpt "uses gpt-4o-mini" /meta "uses meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" /mixtral "uses mistralai/Mixtral-8x7B-Instruct-v0.1" /claude "uses claude-3-haiku-20240307" ] [ if all [blackboxai koboldai gpt meta mixtral claude] [return "ERROR! Using both parameters at the same time will result in a conflict."] url: copy http://pochinoksergey.ru/rebol/ai/ if blackboxai [url: copy http://pochinoksergey.ru/rebol/ai/?p=blackboxai] if koboldai [url: copy http://pochinoksergey.ru/rebol/ai/?p=koboldai] if gpt [url: copy http://pochinoksergey.ru/rebol/ai/?p=gpt] if meta [url: copy http://pochinoksergey.ru/rebol/ai/?p=meta] if mixtral [url: copy http://pochinoksergey.ru/rebol/ai/?p=mixtral] if claude [url: copy http://pochinoksergey.ru/rebol/ai/?p=claude] return first parse/all read/custom url reduce ['post append copy "q=" request] "^(null)" ] ; simple example of using the function ;print ai "Tell me about yourself." ;halt
halt ;; to terminate script if DO'ne from webpage
<< age.r · ai.r >>
Notes
  • 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)