What the helpers of org.llm4s.repl talk to: a client, its completion options, the conversation so far and the statistics of the last call. Set it once as a context parameter and every helper finds it:
import org.llm4s.repl.*
given Session = Session.fromConfig() // the `llm4s.providers.provider` section of application.conf
ask("Explain variance in Scala 3 in two sentences")
A session whose client cannot be built (no application.conf, a missing API key, an unregistered provider) is still a session: every helper prints the configuration error with its troubleshooting hint and returns a failure, so a worksheet never stops on a stack trace. failure says whether that is the case.
A session is for a REPL, a worksheet or a script, not for production code: it keeps the conversation in memory, prints to the console, and its helpers are not meant to be called concurrently. Each with* method returns a new session with the same client and an empty history.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any