# Make streaming APIs easy with enumerable methods

DevFeed: [Make streaming APIs easy with enumerable methods](<https://devfeed.tech/articles/make-streaming-apis-easy-with-enumerable-methods-33525.md>)

Original publisher: [Read original article](<https://www.aha.io/engineering/articles/making-streaming-apis-easy>)

Published: 2024-12-20T00:00:00Z

Content type: tutorial

Language: en

Sources: [Aha! Engineering Blog](<https://devfeed.tech/sources/aha-engineering-blog.md>)

Topics: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Streaming](<https://devfeed.tech/topics/streaming.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [OpenAI](<https://devfeed.tech/topics/openai.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [large-language-model](<https://devfeed.tech/tags/large-language-model.md>), [openai](<https://devfeed.tech/tags/openai.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [ruby-on-rails](<https://devfeed.tech/tags/ruby-on-rails.md>), [streaming](<https://devfeed.tech/tags/streaming.md>)

## AI overview

This tutorial explains how Ruby enumerable methods can make streaming API responses easier to transform and compose. It uses large language model APIs, including the OpenAI chat API, as an example and describes converting block-yielded values into an enumerator.

## Source excerpt

When you first discover Ruby on Rails, some things might strike you right away: namely the large number of enumerable methods and the blocks to run code in the middle of another method. Those features helped me translate my thoughts directly into c