class LLM extends AbstractObject implements IdAble

Properties

$lastQuery from  AbstractObject

Methods

__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

null|array|string|int|float|bool
queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

LLM
attempt(int $number)

create a branch in the LLM's history

bindResult(string $name)

returns the type of the current state

Env
env()

return the LLM's current environment

bool
hasPrompt()

Indicates whether there are any queued prompts or tool results to send to the model

array
history()

return the llm message history

historyJSON()

return the raw llm message history as json

id()

A unique identifier for this LLM.

string
lastReply()

return the last llm reply from the history

LLM
loop()

Submit the queued prompt, evaluate any tool calls, queue their results, and keep going until the model ends its turn

string
model()

return the model used by the llm

string
provider()

return the provider used by the llm

step()

Submit the queued prompt or tool call results, evaluate any tool calls, and queue their results

sync()

synchronize LLM state

tokenUsage()

returns the token usage of the current state

string
tools()

print documentation for available tools

LLM
withBlockedFunction(string $typeName, string $function)

Return a new LLM with the specified function no longer exposed as a tool

LLM
withEnv(Env $env)

allow the LLM to interact with an environment via MCP

LLM
withMCPServer(string $name, Service $service)

Add an external MCP server to the LLM

LLM
withModel(string $model)

swap out the llm model

LLM
withPrompt(string $prompt)

append a prompt to the llm context

LLM
withPromptFile(File $file)

append the contents of a file to the llm context

LLM
withStaticTools()

Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration

LLM
withSystemPrompt(string $prompt)

Add a system prompt to the LLM's environment

LLM
withoutDefaultSystemPrompt()

Disable the default system prompt

Details

in AbstractObject at line 13
__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

Parameters

AbstractClient $client
QueryBuilderChain $queryBuilderChain

in AbstractObject at line 19
protected null|array|string|int|float|bool queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

Parameters

QueryBuilder $leafQueryBuilder
string $leafKey

Return Value

null|array|string|int|float|bool

at line 16
LLM attempt(int $number)

create a branch in the LLM's history

Parameters

int $number

Return Value

LLM

at line 26
Binding bindResult(string $name)

returns the type of the current state

Parameters

string $name

Return Value

Binding

at line 36
Env env()

return the LLM's current environment

Return Value

Env

at line 45
bool hasPrompt()

Indicates whether there are any queued prompts or tool results to send to the model

Return Value

bool

at line 54
array history()

return the llm message history

Return Value

array

at line 63
Json historyJSON()

return the raw llm message history as json

Return Value

Json

at line 72
AbstractId id()

A unique identifier for this LLM.

Return Value

AbstractId

at line 81
string lastReply()

return the last llm reply from the history

Return Value

string

at line 90
LLM loop()

Submit the queued prompt, evaluate any tool calls, queue their results, and keep going until the model ends its turn

Return Value

LLM

at line 99
string model()

return the model used by the llm

Return Value

string

at line 108
string provider()

return the provider used by the llm

Return Value

string

at line 117
LLMId step()

Submit the queued prompt or tool call results, evaluate any tool calls, and queue their results

Return Value

LLMId

at line 126
LLMId sync()

synchronize LLM state

Return Value

LLMId

at line 135
LLMTokenUsage tokenUsage()

returns the token usage of the current state

Return Value

LLMTokenUsage

at line 144
string tools()

print documentation for available tools

Return Value

string

at line 153
LLM withBlockedFunction(string $typeName, string $function)

Return a new LLM with the specified function no longer exposed as a tool

Parameters

string $typeName
string $function

Return Value

LLM

at line 164
LLM withEnv(Env $env)

allow the LLM to interact with an environment via MCP

Parameters

Env $env

Return Value

LLM

at line 174
LLM withMCPServer(string $name, Service $service)

Add an external MCP server to the LLM

Parameters

string $name
Service $service

Return Value

LLM

at line 185
LLM withModel(string $model)

swap out the llm model

Parameters

string $model

Return Value

LLM

at line 195
LLM withPrompt(string $prompt)

append a prompt to the llm context

Parameters

string $prompt

Return Value

LLM

at line 205
LLM withPromptFile(File $file)

append the contents of a file to the llm context

Parameters

File $file

Return Value

LLM

at line 215
LLM withStaticTools()

Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration

Return Value

LLM

at line 224
LLM withSystemPrompt(string $prompt)

Add a system prompt to the LLM's environment

Parameters

string $prompt

Return Value

LLM

at line 234
LLM withoutDefaultSystemPrompt()

Disable the default system prompt

Return Value

LLM