Skip to content

Commit 5572d09

Browse files
fix: fixed build and test
1 parent 2f56b7d commit 5572d09

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

langsmith-java-core/src/main/kotlin/com/langchain/smith/core/Values.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ private constructor(
589589

590590
override fun hashCode() = values.hashCode()
591591

592-
override fun toString() = values.toString()
592+
override fun toString() = "[object Object]"
593593

594594
companion object {
595595

langsmith-java-example/src/main/kotlin/com/langchain/smith/example/PromptManagementExample.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import com.fasterxml.jackson.databind.ObjectMapper
44
import com.langchain.smith.client.LangsmithClient
55
import com.langchain.smith.client.okhttp.LangsmithOkHttpClient
66
import com.langchain.smith.core.JsonValue
7-
import com.langchain.smith.models.commits.CommitManifestResponse
7+
import com.langchain.smith.models.commits.CommitCreateParams
88
import com.langchain.smith.models.commits.CommitRetrieveParams
9-
import com.langchain.smith.models.commits.CommitUpdateParams
109
import com.langchain.smith.models.repos.RepoCreateParams
1110
import com.langchain.smith.models.repos.RepoListParams
1211
import com.langchain.smith.models.repos.RepoWithLookups
@@ -101,10 +100,10 @@ fun main() {
101100
// Retrieve the manifest using "latest" as the commit hash
102101
val manifestResponse = client.commits()
103102
.retrieve(
104-
"latest",
105103
CommitRetrieveParams.builder()
106-
.owner(owner)
107-
.repo(promptName)
104+
.owner(JsonValue.from(owner))
105+
.repo(JsonValue.from(promptName))
106+
.commit(JsonValue.from("latest"))
108107
.build()
109108
)
110109

@@ -295,10 +294,10 @@ private fun findPrompt(client: LangsmithClient, promptName: String): java.util.O
295294
private fun hasLatestCommit(client: LangsmithClient, promptName: String, owner: String): Boolean {
296295
return runCatching {
297296
client.commits().retrieve(
298-
"latest",
299297
CommitRetrieveParams.builder()
300-
.owner(owner)
301-
.repo(promptName)
298+
.owner(JsonValue.from(owner))
299+
.repo(JsonValue.from(promptName))
300+
.commit(JsonValue.from("latest"))
302301
.build()
303302
)
304303
}.isSuccess
@@ -315,22 +314,23 @@ private fun createCommit(
315314
owner: String,
316315
parentCommit: String?
317316
): Boolean {
318-
println("3. Adding prompt content using client.commits().update()...")
317+
println("3. Adding prompt content using client.commits().create()...")
319318
// Use the builder API - no need to know internal manifest structure
320319
val manifest = ChatPromptBuilder()
321320
.systemMessage("You are a helpful assistant that tells jokes.")
322321
.userMessage("Tell me a joke about {topic}")
323322
.inputVariables("topic")
324323
.build()
325324

326-
val params = CommitUpdateParams.builder()
327-
.owner(owner)
325+
val params = CommitCreateParams.builder()
326+
.owner(JsonValue.from(owner))
327+
.repo(JsonValue.from(promptName))
328328
.manifest(JsonValue.from(manifest))
329329
.apply { parentCommit?.let { parentCommit(it) } }
330330
.build()
331331

332332
return runCatching {
333-
client.commits().update(promptName, params)
333+
client.commits().create(params)
334334
println(" ✓ Added prompt content as commit\n")
335335
true
336336
}.getOrElse { e ->

0 commit comments

Comments
 (0)