Skip to content

Commit f0afc1f

Browse files
committed
Beautify
1 parent 65e6a2a commit f0afc1f

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[![Sourcegraph](https://img.shields.io/badge/search-this%20repo-blue)](https://sourcegraph.com/github.com/pbernet/akka_streams_tutorial "Sourcegraph")
2-
[![NotebookLM](https://img.shields.io/badge/listen%20to-this%20repo-blue)](https://notebooklm.google.com/notebook/15ab2fde-4d85-40ed-a7cf-a6fc83223680/audio "NotebookLM")
31
[![GolpoAI](https://img.shields.io/badge/watch-intro-blue)](https://video.golpoai.com/share/53934a0a-8971-43b6-93cc-217f6663bf28 "GolpoAI")
2+
[![NotebookLM](https://img.shields.io/badge/listen%20to-this%20repo-blue)](https://notebooklm.google.com/notebook/15ab2fde-4d85-40ed-a7cf-a6fc83223680/audio "NotebookLM")
3+
[![Sourcegraph](https://img.shields.io/badge/search-this%20repo-blue)](https://sourcegraph.com/github.com/pbernet/akka_streams_tutorial "Sourcegraph")
44
[![Build Status](https://github.com/pbernet/akka_streams_tutorial/actions/workflows/ci.yml/badge.svg)](https://github.com/pbernet/akka_streams_tutorial/actions/workflows/ci.yml)
55
[![Scala Steward](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)
66

@@ -26,13 +26,16 @@ and [Pekko HTTP](https://pekko.apache.org/docs/pekko-http/current/) tutorials, b
2626

2727
"It's working!" a colleague used to shout across the office when yet another proof of concept was running its first few
2828
hundred meters along the happy path, aware that the real work started right there. This repo aims to provide you with
29-
exactly this feeling by offering a collection of runnable examples.
29+
exactly this feeling by offering a collection of runnable examples in Scala and Java.
3030

3131
## Getting Started
3232

3333
### Prerequisites
3434

35-
Java 17 or higher (recommended: [GraalVM](https://www.graalvm.org/downloads))
35+
[Install Java 17 or higher](https://adoptium.net/temurin/releases) (
36+
recommended: [GraalVM](https://www.graalvm.org/downloads))
37+
38+
Install [sbt](https://www.scala-sbt.org/download) and [Docker](https://www.docker.com/get-started/)
3639

3740
### Installation
3841

@@ -49,7 +52,7 @@ behaviour.
4952

5053
## Examples Overview
5154

52-
Some larger examples:
55+
Featured examples with complex workflows:
5356
* [Element deduplication](#element-deduplication)
5457
* [Windturbine example](#windturbine-example)
5558
* [Apache Kafka WordCount](#apache-kafka-wordcount)
@@ -66,10 +69,10 @@ operators in action.
6669
The `*Echo` example series implement round trips eg [HttpFileEcho](src/main/scala/akkahttp/HttpFileEcho.scala)
6770
and [WebsocketEcho](src/main/scala/akkahttp/WebsocketEcho.scala)
6871

69-
Using [testcontainers](https://www.testcontainers.org) allows running realistic scenarios with just one click:
72+
Using [testcontainers](https://www.testcontainers.org) allows running realistic integration test scenarios with just one
73+
click:
7074

7175
* [OIDCKeycloak](src/main/scala/akkahttp/oidc/OIDCKeycloak.scala)
72-
* [SSEtoElasticsearch](src/main/scala/alpakka/sse_to_elasticsearch/SSEtoElasticsearch.scala)
7376
* [ClickhousedbIT](src/test/scala/alpakka/clickhousedb/ClickhousedbIT.java)
7477
* [InfluxdbIT](src/test/scala/alpakka/influxdb/InfluxdbIT.java)
7578
* [SlickIT](src/test/scala/alpakka/slick/SlickIT.java)
@@ -139,10 +142,10 @@ Colin Breck explains these concepts and more in the 2017 Reactive Summit talk [
139142
Islands in the Stream: Integrating Akka Streams and Akka Actors
140143
](https://www.youtube.com/watch?v=qaiwalDyayA&list=PLKKQHTLcxDVayICsjpaPeno6aAPMCCZIz&index=4)
141144

142-
| Class | Description |
143-
| ------------------- |-----------------|
144-
| [SimulateWindTurbines](src/main/scala/sample/stream_actor/SimulateWindTurbines.scala)| Starts n clients which feed measurements to the server|
145-
| [WindTurbineServer](src/main/scala/sample/stream_actor/WindTurbineServer.scala)| Start server which a accumulates measurements|
145+
| Class | Description |
146+
|---------------------------------------------------------------------------------------|--------------------------------------------------------|
147+
| [SimulateWindTurbines](src/main/scala/sample/stream_actor/SimulateWindTurbines.scala) | Starts n clients which feed measurements to the server |
148+
| [WindTurbineServer](src/main/scala/sample/stream_actor/WindTurbineServer.scala) | Start server which collects measurements |
146149

147150
The clients communicate via websockets with the `WindTurbineServer`. After a restart of `SimulateWindTurbines` the clients are able to resume.
148151
Shutting down the `WindTurbineServer` results in reporting to the clients that the server is not reachable.

src/main/scala/sample/stream/SessionWindow.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ object SessionWindow extends App {
4545
Event(1, "A"),
4646
Event(7, "B"), Event(8, "C"),
4747
Event(15, "D"), Event(16, "E"), Event(18, "F"),
48-
Event(25, "G"), Event(26, "H"), Event(26, "I"), Event(28, "J"),
49-
Event(32, "K"),
48+
Event(25, "G"), Event(26, "H"), Event(26, "I"), Event(28, "J"), Event(32, "K"),
5049
Event(42, "L"), Event(43, "M")
5150
))
5251

src/main/scala/tools/OpenAICompletions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static void main(String[] args) {
8484
ImmutablePair<String, Integer> result = new OpenAICompletions().runCompletions(prompt);
8585
CompletionsUtil.logCompletionResult(result.getLeft(), result.getRight(), "Translation");
8686

87-
ImmutablePair<String, Integer> resultWithContext = OpenAICompletions.withContext("The Hangover", 2009).runCompletions(prompt);
87+
ImmutablePair<String, Integer> resultWithContext = OpenAICompletions.withContext("Bob Marley - One Love", 2024).runCompletions(prompt);
8888
CompletionsUtil.logCompletionResult(resultWithContext.getLeft(), resultWithContext.getRight(), "Translation with context");
8989
}
9090

src/main/scala/tools/SubtitleTranslator.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import scala.util.{Failure, Success}
1717
* Workflow:
1818
* - Load all blocks from the .srt source file with [[SrtParser]]
1919
* - Group blocks to scenes (= all blocks within a session window), depending on `maxGapSeconds`
20-
* - Translate all blocks of a scene in one prompt (one line per block) via the API
20+
* - Translate all blocks of a scene in one prompt (one line per block) via the LLM API
2121
* - Continuously write translated blocks to target file
22-
* *
22+
*
2323
* Usage:
2424
* - Wire Params, eg sourceFilePath
2525
* - Decide, whether to use context info to streamline translation
@@ -37,13 +37,13 @@ object SubtitleTranslator extends App {
3737
implicit val executionContext: ExecutionContextExecutor = system.dispatcher
3838

3939
// Params
40-
private val sourceFilePath = "EN_Killers.Of.The.Flower.Moon.srt"
41-
private val targetFilePath = "DE_Killers.Of.The.Flower.Moon.srt"
40+
private val sourceFilePath = "EN_challenges.srt"
41+
private val targetFilePath = "DE_challenges.srt"
4242
private val targetLanguage = "German"
43-
private val movieTitle = "Killers of the Flower Moon"
44-
private val movieReleaseYear = 2023
43+
private val movieTitle = "Bob Marley - One Love"
44+
private val movieReleaseYear = 2024
4545

46-
private val useContext = true
46+
private val useContext = false
4747
private val defaultModel = if (useContext) OpenAICompletions.withContext(movieTitle, movieReleaseYear) else new OpenAICompletions()
4848
private val fallbackModel = if (useContext) AnthropicCompletions.withContext(movieTitle, movieReleaseYear) else new AnthropicCompletions()
4949

0 commit comments

Comments
 (0)