MCPcopy Index your code
hub / github.com/Effect-TS/effect / makePart

Function makePart

packages/ai/ai/src/Prompt.ts:213–233  ·  view source on GitHub ↗
(
  /**
   * The type of part to create.
   */
  type: Type,
  /**
   * Parameters specific to the part type being created.
   */
  params: Omit<Extract<Part, { type: Type }>, PartTypeId | "type" | "options"> & {
    /**
     * Optional provider-specific options for this part.
     */
    readonly options?: Extract<Part, { type: Type }>["options"] | undefined
  }
)

Source from the content-addressed store, hash-verified

211 * @category Constructors
212 */
213export const makePart = <const Type extends Part["type"]>(
214 /**
215 * The type of part to create.
216 */
217 type: Type,
218 /**
219 * Parameters specific to the part type being created.
220 */
221 params: Omit<Extract<Part, { type: Type }>, PartTypeId | "type" | "options"> & {
222 /**
223 * Optional provider-specific options for this part.
224 */
225 readonly options?: Extract<Part, { type: Type }>["options"] | undefined
226 }
227): Extract<Part, { type: Type }> =>
228 ({
229 ...params,
230 [PartTypeId]: PartTypeId,
231 type,
232 options: params.options ?? {}
233 }) as any
234
235/**
236 * A utility type for specifying the parameters required to construct a

Callers 8

textPartFunction · 0.70
reasoningPartFunction · 0.70
filePartFunction · 0.70
toolCallPartFunction · 0.70
toolResultPartFunction · 0.70
Prompt.tsFile · 0.70
makeFunction · 0.70
fromResponsePartsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected