|
10 | 10 | "metadata": {
|
11 | 11 | "collapsed": true,
|
12 | 12 | "ExecuteTime": {
|
13 |
| - "end_time": "2025-09-19T19:49:09.868118Z", |
14 |
| - "start_time": "2025-09-19T19:49:05.225077Z" |
| 13 | + "end_time": "2025-09-21T08:33:23.068468Z", |
| 14 | + "start_time": "2025-09-21T08:33:22.912180Z" |
15 | 15 | }
|
16 | 16 | },
|
17 | 17 | "source": [
|
|
23 | 23 | " mavenCentral()\n",
|
24 | 24 | " }\n",
|
25 | 25 | " dependencies(\n",
|
26 |
| - " \"me.kpavlov.aimocks:ai-mocks-openai-jvm:0.5.0-SNAPSHOT\",\n", |
| 26 | + " \"me.kpavlov.aimocks:ai-mocks-openai-standalone:0.5.0-SNAPSHOT\",\n", |
27 | 27 | " \"io.kotest:kotest-assertions-core:5.9.1\",\n",
|
28 |
| - " \"io.kotest:kotest-assertions-json:5.9.1\",\n", |
29 | 28 | " \"dev.langchain4j:langchain4j-open-ai:1.5.0\",\n",
|
| 29 | + " \"dev.langchain4j:langchain4j-kotlin:1.5.0-beta11\",\n", |
30 | 30 | " )\n",
|
31 | 31 | "}"
|
32 | 32 | ],
|
33 | 33 | "outputs": [],
|
34 |
| - "execution_count": 10 |
| 34 | + "execution_count": 3 |
35 | 35 | },
|
36 | 36 | {
|
37 | 37 | "metadata": {
|
38 | 38 | "ExecuteTime": {
|
39 |
| - "end_time": "2025-09-19T19:49:09.960056Z", |
40 |
| - "start_time": "2025-09-19T19:49:09.877363Z" |
| 39 | + "end_time": "2025-09-21T08:33:27.746433Z", |
| 40 | + "start_time": "2025-09-21T08:33:27.667009Z" |
41 | 41 | }
|
42 | 42 | },
|
43 | 43 | "cell_type": "code",
|
|
51 | 51 | "import io.kotest.matchers.shouldBe\n",
|
52 | 52 | "import io.kotest.matchers.shouldNotBe\n",
|
53 | 53 | "\n",
|
54 |
| - "val openai = MockOpenai(verbose = true)\n", |
| 54 | + "val openai = MockOpenai(verbose = true, port = 0)\n", |
55 | 55 | "\n",
|
56 | 56 | "val model: OpenAiChatModel =\n",
|
57 | 57 | " OpenAiChatModel\n",
|
|
61 | 61 | " .build()\n",
|
62 | 62 | "\n",
|
63 | 63 | "openai.completion {\n",
|
64 |
| - " temperature = 0.42\n", |
65 |
| - " seed = 100500\n", |
| 64 | + "// temperature(0.42) = 0.42\n", |
| 65 | + "// seed = 100500\n", |
66 | 66 | " model = \"4o\"\n",
|
67 | 67 | " maxTokens = 120\n",
|
68 | 68 | "} responds {\n",
|
|
96 | 96 | ],
|
97 | 97 | "outputs": [
|
98 | 98 | {
|
99 |
| - "ename": "java.lang.NoClassDefFoundError", |
100 |
| - "evalue": "io/ktor/server/plugins/contentnegotiation/ContentNegotiationConfig", |
| 99 | + "ename": "org.jetbrains.kotlinx.jupyter.exceptions.ReplCompilerException", |
| 100 | + "evalue": "at Cell In[4], line 3, column 35: Unresolved reference: chat\nat Cell In[4], line 10, column 14: None of the following functions can be called with the arguments supplied: \npublic constructor MockOpenai() defined in me.kpavlov.aimocks.openai.MockOpenai\npublic constructor MockOpenai(port: Int, verbose: Boolean) defined in me.kpavlov.aimocks.openai.MockOpenai\nat Cell In[4], line 20, column 3: Unresolved reference: temperature\nat Cell In[4], line 21, column 3: Unresolved reference: seed\nat Cell In[4], line 22, column 3: Val cannot be reassigned\nat Cell In[4], line 22, column 11: Type mismatch: inferred type is String but OpenAiChatModel was expected\nat Cell In[4], line 23, column 3: Unresolved reference: maxTokens\nat Cell In[4], line 25, column 3: Unresolved reference: assistantContent\nat Cell In[4], line 26, column 3: Unresolved reference: finishReason\nat Cell In[4], line 32, column 11: None of the following functions can be called with the arguments supplied: \npublic open fun chat(p0: ChatRequest!): ChatResponse! defined in dev.langchain4j.model.openai.OpenAiChatModel\npublic open fun chat(vararg p0: ChatMessage!): ChatResponse! defined in dev.langchain4j.model.openai.OpenAiChatModel\npublic open fun chat(p0: String!): String! defined in dev.langchain4j.model.openai.OpenAiChatModel\npublic open fun chat(p0: (Mutable)List<ChatMessage!>!): ChatResponse! defined in dev.langchain4j.model.openai.OpenAiChatModel\nat Cell In[4], line 33, column 7: Unresolved reference: parameters\nat Cell In[4], line 41, column 7: Unresolved reference: messages\nat Cell In[4], line 41, column 16: Unresolved reference: +=\nat Cell In[4], line 45, column 5: Unresolved reference: finishReason\nat Cell In[4], line 46, column 5: Unresolved reference: tokenUsage\nat Cell In[4], line 47, column 5: Unresolved reference: aiMessage", |
101 | 101 | "output_type": "error",
|
102 | 102 | "traceback": [
|
103 |
| - "java.lang.NoClassDefFoundError: io/ktor/server/plugins/contentnegotiation/ContentNegotiationConfig", |
104 |
| - "\tat me.kpavlov.aimocks.openai.MockOpenai.<init>(MockOpenai.kt:33)", |
105 |
| - "\tat me.kpavlov.aimocks.openai.MockOpenai.<init>(MockOpenai.kt:27)", |
106 |
| - "\tat Line_24_jupyter.<init>(Line_24.jupyter.kts:10) at Cell In[11], line 10", |
107 |
| - "\tat java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)", |
108 |
| - "\tat java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)", |
109 |
| - "\tat java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)", |
110 |
| - "\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.evalWithConfigAndOtherScriptsResults(BasicJvmScriptEvaluator.kt:122)", |
111 |
| - "\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke$suspendImpl(BasicJvmScriptEvaluator.kt:48)", |
112 |
| - "\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke(BasicJvmScriptEvaluator.kt)", |
113 |
| - "\tat kotlin.script.experimental.jvm.BasicJvmReplEvaluator.eval(BasicJvmReplEvaluator.kt:49)", |
114 |
| - "\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl$eval$resultWithDiagnostics$1.invokeSuspend(InternalEvaluatorImpl.kt:137)", |
115 |
| - "\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)", |
116 |
| - "\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)", |
117 |
| - "\tat kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)", |
118 |
| - "\tat kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)", |
119 |
| - "\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)", |
120 |
| - "\tat kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)", |
121 |
| - "\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:47)", |
122 |
| - "\tat kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)", |
123 |
| - "\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl.eval(InternalEvaluatorImpl.kt:137)", |
| 103 | + "org.jetbrains.kotlinx.jupyter.exceptions.ReplCompilerException: at Cell In[4], line 3, column 35: Unresolved reference: chat", |
| 104 | + "at Cell In[4], line 10, column 14: None of the following functions can be called with the arguments supplied: ", |
| 105 | + "public constructor MockOpenai() defined in me.kpavlov.aimocks.openai.MockOpenai", |
| 106 | + "public constructor MockOpenai(port: Int, verbose: Boolean) defined in me.kpavlov.aimocks.openai.MockOpenai", |
| 107 | + "at Cell In[4], line 20, column 3: Unresolved reference: temperature", |
| 108 | + "at Cell In[4], line 21, column 3: Unresolved reference: seed", |
| 109 | + "at Cell In[4], line 22, column 3: Val cannot be reassigned", |
| 110 | + "at Cell In[4], line 22, column 11: Type mismatch: inferred type is String but OpenAiChatModel was expected", |
| 111 | + "at Cell In[4], line 23, column 3: Unresolved reference: maxTokens", |
| 112 | + "at Cell In[4], line 25, column 3: Unresolved reference: assistantContent", |
| 113 | + "at Cell In[4], line 26, column 3: Unresolved reference: finishReason", |
| 114 | + "at Cell In[4], line 32, column 11: None of the following functions can be called with the arguments supplied: ", |
| 115 | + "public open fun chat(p0: ChatRequest!): ChatResponse! defined in dev.langchain4j.model.openai.OpenAiChatModel", |
| 116 | + "public open fun chat(vararg p0: ChatMessage!): ChatResponse! defined in dev.langchain4j.model.openai.OpenAiChatModel", |
| 117 | + "public open fun chat(p0: String!): String! defined in dev.langchain4j.model.openai.OpenAiChatModel", |
| 118 | + "public open fun chat(p0: (Mutable)List<ChatMessage!>!): ChatResponse! defined in dev.langchain4j.model.openai.OpenAiChatModel", |
| 119 | + "at Cell In[4], line 33, column 7: Unresolved reference: parameters", |
| 120 | + "at Cell In[4], line 41, column 7: Unresolved reference: messages", |
| 121 | + "at Cell In[4], line 41, column 16: Unresolved reference: +=", |
| 122 | + "at Cell In[4], line 45, column 5: Unresolved reference: finishReason", |
| 123 | + "at Cell In[4], line 46, column 5: Unresolved reference: tokenUsage", |
| 124 | + "at Cell In[4], line 47, column 5: Unresolved reference: aiMessage", |
| 125 | + "\tat org.jetbrains.kotlinx.jupyter.repl.impl.JupyterCompilerImpl.compileSync(JupyterCompilerImpl.kt:151)", |
| 126 | + "\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl.eval(InternalEvaluatorImpl.kt:126)", |
124 | 127 | "\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute_L4Nmkdk$lambda$0$0(CellExecutorImpl.kt:80)",
|
125 | 128 | "\tat org.jetbrains.kotlinx.jupyter.repl.impl.ReplForJupyterImpl.withHost(ReplForJupyterImpl.kt:791)",
|
126 | 129 | "\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute-L4Nmkdk(CellExecutorImpl.kt:78)",
|
|
147 | 150 | "\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl$Task.execute(JupyterExecutorImpl.kt:41)",
|
148 | 151 | "\tat org.jetbrains.kotlinx.jupyter.execution.JupyterExecutorImpl.executorThread$lambda$0(JupyterExecutorImpl.kt:81)",
|
149 | 152 | "\tat kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)",
|
150 |
| - "", |
151 |
| - "java.lang.NoClassDefFoundError: io/ktor/server/plugins/contentnegotiation/ContentNegotiationConfig", |
152 |
| - "at Cell In[11], line 10" |
| 153 | + "" |
153 | 154 | ]
|
154 | 155 | }
|
155 | 156 | ],
|
156 |
| - "execution_count": 11 |
| 157 | + "execution_count": 4 |
157 | 158 | }
|
158 | 159 | ],
|
159 | 160 | "metadata": {
|
|
0 commit comments