MCPcopy Create free account
hub / github.com/anomalyco/opencode / request

Function request

packages/llm/src/llm.ts:53–75  ·  view source on GitHub ↗
(input: RequestInput)

Source from the content-addressed store, hash-verified

51})
52
53export const request = (input: RequestInput) => {
54 const {
55 system: requestSystem,
56 prompt,
57 messages,
58 tools,
59 toolChoice: requestToolChoice,
60 generation: requestGeneration,
61 providerOptions: requestProviderOptions,
62 http: requestHttp,
63 ...rest
64 } = input
65 return new LLMRequest({
66 ...rest,
67 system: SystemPart.content(requestSystem),
68 messages: [...(messages?.map(Message.make) ?? []), ...(prompt === undefined ? [] : [Message.user(prompt)])],
69 tools: tools?.map(ToolDefinition.make) ?? [],
70 toolChoice: requestToolChoice ? ToolChoice.make(requestToolChoice) : undefined,
71 generation: requestGeneration === undefined ? undefined : GenerationOptions.make(requestGeneration),
72 providerOptions: requestProviderOptions,
73 http: requestHttp === undefined ? undefined : HttpOptions.make(requestHttp),
74 })
75}
76
77export const updateRequest = (input: LLMRequest, patch: Partial<RequestInput>) =>
78 request({ ...requestInput(input), ...patch })

Callers 2

updateRequestFunction · 0.70
llm.tsFile · 0.70

Calls 1

makeMethod · 0.45

Tested by

no test coverage detected