Back to Dagger

LLM

docs/static/reference/php/Dagger/LLM.html

0.21.28.8 KB
Original Source

LLM

class LLM extends AbstractObject implements IdAble, Node, Syncer

Properties

| | $lastQuery | | from AbstractObject |

Methods

__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

from AbstractObject

null|array|string|int|float|bool

queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

from AbstractObject

LLM

attempt(int $number)

create a branch in the LLM's history

Binding

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

Json

historyJSON()

return the raw llm message history as json

Id

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

LLM

step()

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

Syncer

sync()

synchronize LLM state

LLMTokenUsage

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

LLM

withoutMessageHistory()

Clear the message history, leaving only the system prompts

LLM

withoutSystemPrompts()

Clear the system prompts, leaving only 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 Id id()

A unique identifier for this LLM.

Return Value

| Id | |

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 LLM step()

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

Return Value

| LLM | |

at line 127 Syncer sync()

synchronize LLM state

Return Value

| Syncer | |

at line 137 LLMTokenUsage tokenUsage()

returns the token usage of the current state

Return Value

| LLMTokenUsage | |

at line 146 string tools()

print documentation for available tools

Return Value

| string | |

at line 155 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 166 LLM withEnv(Env $env)

allow the LLM to interact with an environment via MCP

Parameters

| Env | $env | |

Return Value

| LLM | |

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

Add an external MCP server to the LLM

Parameters

| string | $name | | | Service | $service | |

Return Value

| LLM | |

at line 187 LLM withModel(string $model)

swap out the llm model

Parameters

| string | $model | |

Return Value

| LLM | |

at line 197 LLM withPrompt(string $prompt)

append a prompt to the llm context

Parameters

| string | $prompt | |

Return Value

| LLM | |

at line 207 LLM withPromptFile(File $file)

append the contents of a file to the llm context

Parameters

| File | $file | |

Return Value

| LLM | |

at line 217 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 226 LLM withSystemPrompt(string $prompt)

Add a system prompt to the LLM's environment

Parameters

| string | $prompt | |

Return Value

| LLM | |

at line 236 LLM withoutDefaultSystemPrompt()

Disable the default system prompt

Return Value

| LLM | |

at line 245 LLM withoutMessageHistory()

Clear the message history, leaving only the system prompts

Return Value

| LLM | |

at line 254 LLM withoutSystemPrompts()

Clear the system prompts, leaving only the default system prompt

Return Value

| LLM | |

Generated by Doctum, a API Documentation generator and fork of Sami.