Class responsible for managing the interaction with the Replicate API. It handles the API key and model details, makes the actual API calls, and converts the API response into a format usable by the rest of the LangChain framework.

Example

const model = new Replicate({
model: "replicate/flan-t5-xl:3ae0799123a1fe11f8c89fd99632f843fc5f7a761630160521c4253149754523",
});

const res = await model.invoke(
"Question: What would be a good company name for a company that makes colorful socks?\nAnswer:"
);
console.log({ res });

Hierarchy (view full)

Implements

Constructors

Properties

apiKey: string
input: undefined | {
    [key: string]: string | number | boolean;
}

Type declaration

  • [key: string]: string | number | boolean
model: `${string}/${string}` | `${string}/${string}:${string}`
streaming: boolean

Whether or not to stream tokens as they are generated.

Default

{false}
promptKey?: string

The key used to pass prompts to the model.

Generated using TypeDoc