
Version 0.3
artgemini 0.3.0
Breaking Change - Interactive Chat with Streaming
-
Redesigned
gemini_chat()function - Now creates reusable chat objects for interactive, multi-turn conversations with streaming support. Built on {ellmer} for robust provider integration.BREAKING: The function signature has changed. It no longer accepts a
promptparameter for single-turn chat.# Old (0.2.0) gemini_chat("Hello") # Returns text # New (0.3.0) - For multi-turn conversations chat <- gemini_chat() chat$chat("Hello") # Returns text # New (0.3.0) - For single-turn, use gemini_generate() gemini_generate(contents = list( list(role = "user", parts = list(list(text = "Hello"))) )) -
ellmer Chat object methods:
-
$chat(...)- Send message(s), receive text response -
$stream(...)- Stream response chunks for real-time display -
$chat_structured(prompt, type)- Extract structured data with type validation -
$register_tool(tool)- Add tools for function calling
-
-
Image and file input via ellmer content helpers:
chat$chat(ellmer::content_image_file("artwork.png"), "Describe this.") chat$chat(ellmer::content_image_url("https://..."), "What style?") -
Streaming for real-time UI:
Use Case Guidance
| Use Case | Function | Why |
|---|---|---|
| Interactive chat | gemini_chat() |
Multi-turn, streaming, session state |
| Pipeline/structured | gemini_generate() |
Single-turn, JSON schemas, batch |
| Manual conversation | gemini_continue() |
Fine-grained control |