/* Sentiment and tone analysis — C++17 terminal example. */ #include "basis_cli.h" #include "basis_backend.h" #include "../large_language_models.hpp" #include #include #include int main(int argc,char **argv) { sllm_basis_cli cli; char prompt[SLLM_BASIS_PROMPT_CAPACITY]; const int parsed=sllm_basis_parse_cli(argc,argv,&cli); if(parsed==1){sllm_basis_usage(argv[0],"Sentiment and tone analysis");return 0;} if(parsed!=0||!sllm_basis_format_prompt(prompt,sizeof(prompt),"Analyze the sentiment and communicative tone of the supplied text. Return a concise label, confidence expressed qualitatively, and the words or phrases supporting the assessment. Do not infer the author's identity.",&cli)){ sllm_basis_usage(argv[0],"Sentiment and tone analysis");return 2; } const sllm_backend *backend=sllm_basis_backend(); if(!backend){std::cerr<<"No LLM provider adapter configured; link an implementation of sllm_basis_backend().\n";return 3;} try { sleela::ai::LanguageModel model(*backend); model.load(cli.model); sleela::ai::GenerationOptions options; options.max_new_tokens=cli.max_new_tokens; options.temperature=cli.temperature; options.top_p=cli.top_p; options.seed=cli.seed; model.generate(prompt,options,[](std::string_view chunk){ std::cout.write(chunk.data(),static_cast(chunk.size())); std::cout.flush(); return static_cast(std::cout); }); std::cout<<'\n'; return 0; } catch(const std::exception& error) { std::cerr<<"\nLLM operation failed: "<