Skip to contents

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 prompt parameter 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:

    stream <- chat$stream("Tell me about Impressionism.")
    coro::loop(for (chunk in stream) cat(chunk))

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

Dependencies

  • Added to Imports: ellmer (>= 0.2.0) - Provides Chat object abstraction with streaming

Integration with artcurator

This release enables artcurator to provide unified chat interfaces across providers:

# artcurator can now offer:
curator_chat_new(artist_uuid, provider = "gemini")
# Returns ellmer Chat with artist context as system prompt