Files
docs/build/snippets/python/code-samples/manage-prompts-push-java.mdx
T
2026-07-29 10:28:19 +00:00

38 lines
996 B
Plaintext

```java Java
import com.langchain.smith.client.LangsmithClient;
import com.langchain.smith.client.okhttp.LangsmithOkHttpClient;
import com.langchain.smith.core.JsonValue;
import com.langchain.smith.models.commits.CommitCreateParams;
import com.langchain.smith.models.repos.RepoCreateParams;
import java.util.List;
import java.util.Map;
LangsmithClient client = LangsmithOkHttpClient.fromEnv();
client.repos().create(
RepoCreateParams.builder()
.repoHandle("joke-generator")
.isPublic(false)
.build()
);
Map<String, Object> manifest = Map.of(
"lc", 1,
"type", "constructor",
"id", List.of("langchain_core", "prompts", "prompt", "PromptTemplate"),
"kwargs", Map.of(
"template", "tell me a joke about {topic}",
"input_variables", List.of("topic")
)
);
client.commits().create(
CommitCreateParams.builder()
.owner("-")
.repo("joke-generator")
.manifest(JsonValue.from(manifest))
.build()
);
```