Zephyr 7b is the really good at generating roleplaying Text and it’s a Free model hosted on inference on Huggingface. It’s the best.
The function inputs the arguments
function Zephyr7B(person,personality,Playername,quer)
BearerKey="Get your APi Key for free from Huggingface"
function cm.Zephyr(person,personality,Playername,quer)
-- Define the API URL and the authorization header
local API_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"
local headers = {Authorization = BearerKey}
-- Define the HttpService
local HttpService = game:GetService("HttpService")
-- Define a function that takes an input and queries the model
local function queryModel(input)
-- Create a payload table with the input
local payload = {inputs = input}
-- Encode the payload table into a JSON string
local payloadJSON = HttpService:JSONEncode(payload)
-- Send a POST request to the API URL with the header and the payload
local response = HttpService:PostAsync(API_URL, payloadJSON, Enum.HttpContentType.ApplicationJson, false, headers)
-- Decode the response into a table
local responseTable = HttpService:JSONDecode(response)
-- Return the response table
return responseTable
end
-- Test the function with an example input
local input = "<|system|>\n You are a "..personality.." named "..person.."..</s>\n<|user|>\n"..quer.."</s>\n<|assistant|>"
local output = queryModel(input)
-- Print the output
print(output)
end