Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
358 changes: 320 additions & 38 deletions notebooks/agents/Evaluator-Optimizer Workflow.ipynb

Large diffs are not rendered by default.

165 changes: 89 additions & 76 deletions notebooks/agents/Orchestrator-Workers Workflow.ipynb

Large diffs are not rendered by default.

602 changes: 225 additions & 377 deletions notebooks/agents/Parallelization Workflow.ipynb

Large diffs are not rendered by default.

79 changes: 59 additions & 20 deletions notebooks/agents/Prompt-Chaining Workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,23 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-05-11T21:48:44.069877Z",
"start_time": "2025-05-11T21:48:43.106474Z"
"end_time": "2025-11-30T13:48:49.259877Z",
"start_time": "2025-11-30T13:48:48.611866Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_3_jupyter",
"Line_4_jupyter",
"Line_5_jupyter",
"Line_6_jupyter"
]
}
},
"cell_type": "code",
"source": [
"%useLatestDescriptors\n",
"%use coroutines\n",
"%use langchain4j(1.0.0-beta3, anthropic)"
"%use langchain4j(model = anthropic)"
],
"outputs": [],
"execution_count": 1
Expand All @@ -61,8 +69,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-11T21:48:44.100358Z",
"start_time": "2025-05-11T21:48:44.073812Z"
"end_time": "2025-11-30T13:48:49.295090Z",
"start_time": "2025-11-30T13:48:49.260582Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_7_jupyter"
]
}
},
"cell_type": "code",
Expand All @@ -82,14 +95,19 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-11T21:48:49.867603Z",
"start_time": "2025-05-11T21:48:49.653724Z"
"end_time": "2025-11-30T13:48:49.530413Z",
"start_time": "2025-11-30T13:48:49.295646Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_8_jupyter"
]
}
},
"cell_type": "code",
"source": [
"import dev.langchain4j.data.message.SystemMessage.systemMessage\n",
"import dev.langchain4j.data.message.UserMessage.userMessage\n",
"import dev.langchain4j.data.message.SystemMessage\n",
"import dev.langchain4j.data.message.UserMessage\n",
"\n",
"suspend fun llmCall(\n",
" prompt: String,\n",
Expand All @@ -104,10 +122,11 @@
" .build()\n",
"\n",
" return withContext(Dispatchers.IO) {\n",
" val response = client.chat {\n",
" systemPrompt?.let { messages += systemMessage(it) }\n",
" messages += userMessage(prompt)\n",
" val messages = buildList {\n",
" systemPrompt?.let { add(SystemMessage(it)) }\n",
" add(UserMessage(prompt))\n",
" }\n",
" val response = client.chat(messages)\n",
" response.aiMessage().text()\n",
" }\n",
"}"
Expand All @@ -127,8 +146,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-11T21:48:51.193436Z",
"start_time": "2025-05-11T21:48:51.107695Z"
"end_time": "2025-11-30T13:48:49.661604Z",
"start_time": "2025-11-30T13:48:49.533742Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_9_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -165,8 +189,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-11T21:48:52.902515Z",
"start_time": "2025-05-11T21:48:52.879801Z"
"end_time": "2025-11-30T13:48:49.747609Z",
"start_time": "2025-11-30T13:48:49.666371Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_10_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -221,8 +250,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-11T21:48:54.455677Z",
"start_time": "2025-05-11T21:48:54.431018Z"
"end_time": "2025-11-30T13:48:49.807284Z",
"start_time": "2025-11-30T13:48:49.751656Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_11_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -251,8 +285,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-11T21:49:08.576050Z",
"start_time": "2025-05-11T21:48:57.097290Z"
"end_time": "2025-11-30T13:48:56.353802Z",
"start_time": "2025-11-30T13:48:49.816409Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_12_jupyter"
]
}
},
"cell_type": "code",
Expand Down
137 changes: 70 additions & 67 deletions notebooks/agents/Routing Workflow.ipynb

Large diffs are not rendered by default.

101 changes: 76 additions & 25 deletions notebooks/kinference/KIClassification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-02-10T13:00:12.108015Z",
"start_time": "2025-02-10T13:00:11.530587Z"
"end_time": "2025-11-30T14:10:40.342805Z",
"start_time": "2025-11-30T14:10:33.108236Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_3_jupyter",
"Line_4_jupyter",
"Line_5_jupyter"
]
}
},
"source": [
"%use kotlin-dl\n",
"\n",
"val kinferenceVersion = \"0.2.26\"\n",
"val ktorVersion = \"3.0.3\"\n",
"val kinferenceVersion = \"0.2.27\"\n",
"val ktorVersion = \"3.3.3\"\n",
"\n",
"USE {\n",
" repositories {\n",
Expand All @@ -39,8 +46,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:00:12.347215Z",
"start_time": "2025-02-10T13:00:12.295281Z"
"end_time": "2025-11-30T14:10:40.394384Z",
"start_time": "2025-11-30T14:10:40.344734Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_6_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -76,8 +88,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:00:34.395122Z",
"start_time": "2025-02-10T13:00:34.137897Z"
"end_time": "2025-11-30T14:10:40.671158Z",
"start_time": "2025-11-30T14:10:40.398352Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_7_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -144,8 +161,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:00:42.121114Z",
"start_time": "2025-02-10T13:00:42.095847Z"
"end_time": "2025-11-30T14:10:40.710096Z",
"start_time": "2025-11-30T14:10:40.672181Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_8_jupyter"
]
}
},
"cell_type": "code",
Expand All @@ -160,8 +182,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:00:48.526585Z",
"start_time": "2025-02-10T13:00:48.451536Z"
"end_time": "2025-11-30T14:10:40.833103Z",
"start_time": "2025-11-30T14:10:40.711316Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_9_jupyter"
]
}
},
"cell_type": "code",
Expand All @@ -183,8 +210,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:00:53.440965Z",
"start_time": "2025-02-10T13:00:52.959882Z"
"end_time": "2025-11-30T14:10:41.338242Z",
"start_time": "2025-11-30T14:10:40.833958Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_10_jupyter"
]
}
},
"cell_type": "code",
Expand All @@ -198,8 +230,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:00:58.001898Z",
"start_time": "2025-02-10T13:00:57.796134Z"
"end_time": "2025-11-30T14:10:41.694368Z",
"start_time": "2025-11-30T14:10:41.339067Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_11_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -245,8 +282,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:01:04.122663Z",
"start_time": "2025-02-10T13:01:04.003458Z"
"end_time": "2025-11-30T14:10:41.922928Z",
"start_time": "2025-11-30T14:10:41.695266Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_12_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -276,8 +318,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:01:20.419350Z",
"start_time": "2025-02-10T13:01:20.390133Z"
"end_time": "2025-11-30T14:10:41.987595Z",
"start_time": "2025-11-30T14:10:41.926778Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_13_jupyter"
]
}
},
"cell_type": "code",
Expand All @@ -292,8 +339,13 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-10T13:02:55.575404Z",
"start_time": "2025-02-10T13:02:41.686551Z"
"end_time": "2025-11-30T14:11:04.065051Z",
"start_time": "2025-11-30T14:10:41.989196Z"
},
"executionRelatedData": {
"compiledClasses": [
"Line_14_jupyter"
]
}
},
"cell_type": "code",
Expand Down Expand Up @@ -327,9 +379,8 @@
"output_type": "stream",
"text": [
"Downloading model from: https://github.com/onnx/models/raw/main/validated/vision/classification/caffenet/model/caffenet-12.onnx\n",
"File already exists at /Users/pavel.gorgulov/Projects/Kotlin/Kotlin-AI-Examples/notebooks/kinference/.cache/CaffeNet.onnx. Skipping download.\n",
"Predefined directory doesn't exist. Creating directory at /Users/pavel.gorgulov/Projects/main_project/AI/Kotlin-AI-Examples/notebooks/kinference//.cache/.\n",
"Downloading synset from: https://s3.amazonaws.com/onnx-model-zoo/synset.txt\n",
"File already exists at /Users/pavel.gorgulov/Projects/Kotlin/Kotlin-AI-Examples/notebooks/kinference/.cache/synset.txt. Skipping download.\n",
"Loading model...\n",
"Creating inputs...\n",
"Starting inference...\n",
Expand Down Expand Up @@ -1136,7 +1187,7 @@
]
}
],
"execution_count": 11
"execution_count": 10
}
],
"metadata": {
Expand Down
Loading