Effect CommunityEC
Effect Community8mo ago
8 replies
Dmitrii Bykov

Clarification on Using `generateText` with AI Response in Effect TS AI Package

Hey!
https://github.com/Effect-TS/effect/blob/main/packages/ai/ai/CHANGELOG.md
In AI package changelog we have this Toolkit Usage example:
const makeDadJoke = Effect.gen(function* () {
  const languageModel = yield* AiLanguageModel.AiLanguageModel
  const toolkit = yield* DadJokeTools

  const response = yield* languageModel.generateText({
    prompt: "Come up with a dad joke about pirates",
    toolkit
  })

  return yield* languageModel.generateText({
    prompt: response
  })
})

Could you please explain me why would you use second generateText method setting prompt as the response from the previews generateText call which is type of AiResponse.WithToolCallResults?
If you wanted the LLM to interpret the joke, wouldn't you need to set system prompt asking for it?
Was this page helpful?