RAG

Do rag ez

void main() async {
  RagAgent agent = RagAgent(
    user: "dan",
    llm: OpenAIConnector(apiKey: openaiKey).connect(ChatModel.openai4_1),
    chatProvider: MemoryChatProvider(
      messages: [
        // Initial system message
        Message.system(
          "You are a helpful assistant. You retrieve records about the patient 'Jane Doe' for caregivers. You will need to access data before you can answer the caregivers questions.",
        ),
      ],
    ),
    vectorSpace: PineconeVectorSpace(
      namespace: "<some namespace>",
      host: "https://name-xxx.pinecone.io",
      apiKey: pineconeKey,
    ),
  );

  await agent.addMessage(Message.user("What is the patients date of birth?"));
  AgentMessage answer = await agent.rag();

  /// Show output of model
  for (Message message in await agent.readMessages()) {
    print(
      "${message.runtimeType.toString().replaceAll("Message", "")}: ${message.content}",
    );
  }
}