diff --git a/.gradle/8.0.2/executionHistory/executionHistory.bin b/.gradle/8.0.2/executionHistory/executionHistory.bin index ff41814b..a35d85ae 100644 Binary files a/.gradle/8.0.2/executionHistory/executionHistory.bin and b/.gradle/8.0.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.0.2/executionHistory/executionHistory.lock b/.gradle/8.0.2/executionHistory/executionHistory.lock index 712555c7..a9bf2c8d 100644 Binary files a/.gradle/8.0.2/executionHistory/executionHistory.lock and b/.gradle/8.0.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.0.2/fileHashes/fileHashes.bin b/.gradle/8.0.2/fileHashes/fileHashes.bin index 1163d27e..af2ff135 100644 Binary files a/.gradle/8.0.2/fileHashes/fileHashes.bin and b/.gradle/8.0.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.0.2/fileHashes/fileHashes.lock b/.gradle/8.0.2/fileHashes/fileHashes.lock index 0e994bbd..828ff49b 100644 Binary files a/.gradle/8.0.2/fileHashes/fileHashes.lock and b/.gradle/8.0.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.0.2/fileHashes/resourceHashesCache.bin b/.gradle/8.0.2/fileHashes/resourceHashesCache.bin index a438ab3d..af0437b7 100644 Binary files a/.gradle/8.0.2/fileHashes/resourceHashesCache.bin and b/.gradle/8.0.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index baf88316..85c47759 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index a1a3f70d..20e41fb9 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/_scripts/Makefile b/_scripts/Makefile deleted file mode 100644 index 5c324bae..00000000 --- a/_scripts/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -.PHONY: all run clean - -all: run - -JAR_FILE = langsmith-traceable-0.0.1-alpha.0.jar -JAR_DIR = langsmith-traceable -# TARGET_CLASS = TestTraceable -# TARGET_CLASS = TestRunTree -TARGET_CLASS = RunOnDataset - -$(JAR_FILE): - @echo "Building jar file" - cd ../ && ./gradlew build - -run: $(JAR_FILE) - @echo "Copying jar file" - cp ../$(JAR_DIR)/build/libs/$(JAR_FILE) . - @echo "Running TestClient" - javac -cp $(JAR_FILE) $(TARGET_CLASS).java - java -Dorg.aspectj.weaver.showWeaveInfo=true -cp $(JAR_FILE):. $(TARGET_CLASS) - -clean: - rm -f *.jar *.class \ No newline at end of file diff --git a/_scripts/RunOnDataset.class b/_scripts/RunOnDataset.class deleted file mode 100644 index f3014a4a..00000000 Binary files a/_scripts/RunOnDataset.class and /dev/null differ diff --git a/_scripts/TestRunTree.java b/_scripts/TestRunTree.java deleted file mode 100644 index 68547c1a..00000000 --- a/_scripts/TestRunTree.java +++ /dev/null @@ -1,56 +0,0 @@ -import com.langsmith.api.client.LangSmithClientAsync; -import com.langsmith.api.client.okhttp.LangSmithOkHttpClientAsync; -import com.langsmith.core.RunTree; -import com.langsmith.core.RunTreeConfig; -import com.langsmith.core.RunTreeConfigBuilder; - -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -public class TestRunTree { - public static void main(String[] args) { - LangSmithClientAsync client = LangSmithOkHttpClientAsync.fromEnv(); - - // Create a RunTreeConfig object - var builder = new RunTreeConfigBuilder(); - builder.setName("Test Run"); - builder.setRunType("llm"); - builder.setInputs(Map.of("input", "Testing!")); - var config = builder.build(); - - // Create a RunTree object - RunTree runTree = new RunTree(config); - - var childBuilder = new RunTreeConfigBuilder(); - childBuilder.setName("Test Child Run"); - childBuilder.setInputs(Map.of("input", "Test2!")); - var childConfig = childBuilder.build(); - - // Time it - var startTime = System.currentTimeMillis(); - - // Using TLS - RunTree childTree = RunTree.fromCurrentSpan(childConfig); - var parentFuture = runTree.postRunAsync(true); - var endTime = System.currentTimeMillis(); - var elapsedTime = endTime - startTime; - System.out.println("Post1 elapsed time: " + elapsedTime + " milliseconds"); - var childFuture = childTree.postRunAsync(true); - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - System.out.println("Post2 time: " + elapsedTime + " milliseconds"); - var childEndFuture = childTree.endAsync(Map.of("output", "Test Output"), null, null); - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - System.out.println("End1 elapsed time: " + elapsedTime + " milliseconds"); - var parentEndFuture = runTree.endAsync(Map.of("output", "Test Output Parent"), null, null); - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - System.out.println("End parent elapsed time: " + elapsedTime + " milliseconds"); - - // Calculate elapsed time - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - System.out.println("Total lapsed time: " + elapsedTime + " milliseconds"); - } -} \ No newline at end of file diff --git a/_scripts/TestTraceable.java b/_scripts/TestTraceable.java deleted file mode 100644 index e25d12b9..00000000 --- a/_scripts/TestTraceable.java +++ /dev/null @@ -1,37 +0,0 @@ -import com.langsmith.core.Traceable; -import com.langsmith.core.TraceConfig; -import com.langsmith.core.RunTree; -import static com.langsmith.core.RunTreeKt.getCurrentSpan; - -class TestTraceable { - public static void main(String[] args) { - TestTraceable testInstance = new TestTraceable(); - - // Trace a class method by applying Traceable.trace to the method reference - var tracedMethod = Traceable.trace(testInstance::someMethod); - var currentSpan = getCurrentSpan(); - System.out.println("getCurrentSpan: " + currentSpan); - String result = tracedMethod.apply(42); - System.out.println("Traced method result: " + result); - currentSpan = getCurrentSpan(); - System.out.println("getCurrentSpan: " + currentSpan); - - var tracedLambda = Traceable.trace(input -> testInstance.anotherMethod(input)); - Integer lambdaResult = tracedLambda.apply(24); - System.out.println("Traced lambda result: " + lambdaResult); - } - - public String someNestedMethod(Integer input) { - return "Nested Input: " + input; - } - - public String someMethod(Integer input) { - TraceConfig config = new TraceConfig(); - config.setName("CustomTraceName"); - return "Top input: " + Traceable.trace(this::someNestedMethod, config).apply(input); - } - - public Integer anotherMethod(Integer value) { - return value * 2; - } -} diff --git a/_scripts/fake_server.py b/_scripts/fake_server.py deleted file mode 100644 index 5a336502..00000000 --- a/_scripts/fake_server.py +++ /dev/null @@ -1,51 +0,0 @@ -import fastapi - - -app = fastapi.FastAPI() - - -@app.get("/runs/{run_id}") -@app.get("/runs") -@app.post("/runs") -async def handle_post_request(request: fastapi.Request): - # Print request params - print("Request Params:") - for param in request.query_params: - print(f"{param}: {request.query_params[param]}") - - # Print request body - print("Request Body:") - print(await request.body()) - - # Print request headers - print("Request Headers:") - for header in request.headers: - print(f"{header}: {request.headers[header]}") - - return {"message": "Request processed successfully"} - - -if __name__ == "__main__": - import uvicorn - - uvicorn.run(app, host="0.0.0.0", port=8111) - -# import uuid - -# uid = str(uuid.uuid4()) - -# requests.post( -# "https://api.smith.langchain.com/runs", -# json={ -# "start_time": "2024-03-08T22:31:49Z", -# "inputs": {"input": "Hello, World!"}, -# "name": "Java Test", -# "end_time": "2024-03-08T22:32:49Z", -# "id": uid, -# "run_type": "chain", -# }, -# headers={ -# "x-api-key": "ls__08ccb807d88042109e82ca41da4c299f", -# "accept-encoding": "gzip", -# }, -# ) diff --git a/_scripts/langsmith-traceable-0.0.1-alpha.0.jar b/_scripts/langsmith-traceable-0.0.1-alpha.0.jar deleted file mode 100644 index 3faf69d0..00000000 Binary files a/_scripts/langsmith-traceable-0.0.1-alpha.0.jar and /dev/null differ diff --git a/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.bin b/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.bin index 3440a8ed..32dbce1d 100644 Binary files a/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.bin and b/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.bin differ diff --git a/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.lock b/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.lock index a8aed124..4bebfbf4 100644 Binary files a/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.lock and b/buildSrc/.gradle/8.0.2/executionHistory/executionHistory.lock differ diff --git a/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 011f001e..bc11e305 100644 Binary files a/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 639fd14e..3db8d72e 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { // Assuming langsmith-java-core and langsmith-java-client-okhttp are needed for the examples implementation(project(":langsmith-java-core")) implementation(project(":langsmith-java-client-okhttp")) - implementation(project(":langsmith-traceable")) + implementation(project(":langsmith-java-trace")) // Add any additional dependencies your examples need implementation("com.google.guava:guava:33.0-jre") diff --git a/_scripts/RunOnDataset.java b/examples/src/main/java/com/langsmith/example/RunOnDataset.java similarity index 93% rename from _scripts/RunOnDataset.java rename to examples/src/main/java/com/langsmith/example/RunOnDataset.java index 7c443ea7..eb9fc330 100644 --- a/_scripts/RunOnDataset.java +++ b/examples/src/main/java/com/langsmith/example/RunOnDataset.java @@ -1,16 +1,14 @@ +package com.langsmith.example; + import com.langsmith.api.client.LangSmithClientAsync; import com.langsmith.api.client.okhttp.LangSmithOkHttpClientAsync; -import com.langsmith.core.RunTree; -import com.langsmith.core.RunTreeConfig; -import com.langsmith.core.RunTreeConfigBuilder; import com.langsmith.api.models.DatasetListParams; import com.langsmith.api.models.ExampleListParams; import com.langsmith.api.models.Example; import com.langsmith.api.models.SessionCreateParams; -import com.langsmith.core.TraceConfig; -import com.langsmith.core.Traceable; -import com.langsmith.core.TraceableInput; -import com.langsmith.core.LangSmithExtra; +import com.langsmith.traceable.TraceConfig; +import com.langsmith.traceable.Traceable; +import com.langsmith.traceable.LangSmithExtra; import com.langsmith.api.core.JsonValue; import java.util.Map; diff --git a/_scripts/TestClient.java b/examples/src/main/java/com/langsmith/example/TestClient.java similarity index 89% rename from _scripts/TestClient.java rename to examples/src/main/java/com/langsmith/example/TestClient.java index 11d0c406..5eb103bc 100644 --- a/_scripts/TestClient.java +++ b/examples/src/main/java/com/langsmith/example/TestClient.java @@ -1,17 +1,11 @@ -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; +package com.langsmith.example; + import com.fasterxml.jackson.databind.ObjectMapper; import com.langsmith.api.client.LangSmithClient; import com.langsmith.api.client.okhttp.LangSmithOkHttpClient; import com.langsmith.api.models.RunCreateParams; import com.langsmith.api.models.RunUpdateParams; -import com.langsmith.api.models.RunCreateResponse; -import com.langsmith.api.models.FeedbackCreateParams; -import com.langsmith.api.models.FeedbackSchema; import com.langsmith.api.core.JsonValue; -import com.langsmith.api.models.RunRetrieveParams; -import com.langsmith.api.models.RunSchema; -import com.langsmith.api.core.RequestOptions; import java.time.LocalDateTime; import java.time.ZoneOffset; diff --git a/langsmith-traceable/build.gradle.kts b/langsmith-java-trace/build.gradle.kts similarity index 100% rename from langsmith-traceable/build.gradle.kts rename to langsmith-java-trace/build.gradle.kts diff --git a/langsmith-traceable/src/main/kotlin/com/langsmith/runtree/RunTree.kt b/langsmith-java-trace/src/main/kotlin/com/langsmith/runtree/RunTree.kt similarity index 100% rename from langsmith-traceable/src/main/kotlin/com/langsmith/runtree/RunTree.kt rename to langsmith-java-trace/src/main/kotlin/com/langsmith/runtree/RunTree.kt diff --git a/langsmith-traceable/src/main/kotlin/com/langsmith/traceable/Traceable.kt b/langsmith-java-trace/src/main/kotlin/com/langsmith/traceable/Traceable.kt similarity index 100% rename from langsmith-traceable/src/main/kotlin/com/langsmith/traceable/Traceable.kt rename to langsmith-java-trace/src/main/kotlin/com/langsmith/traceable/Traceable.kt diff --git a/langsmith-traceable/src/main/resources/META-INF/aop.xml b/langsmith-java-trace/src/main/resources/META-INF/aop.xml similarity index 100% rename from langsmith-traceable/src/main/resources/META-INF/aop.xml rename to langsmith-java-trace/src/main/resources/META-INF/aop.xml diff --git a/settings.gradle.kts b/settings.gradle.kts index 5dba9e34..a24105a8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,5 +4,5 @@ include("langsmith-java") include("langsmith-java-client-okhttp") include("langsmith-java-core") include("langsmith-java-example") -include("langsmith-traceable") +include("langsmith-java-trace") include("examples")