Skip to content

Commit b16e268

Browse files
authored
judgeval instrumentation, package structure, add getters on base tracer (#15)
* wip * wip * wip * wip * example * chore: ci * chore: ci * ok * bump: pom * sync versions
1 parent 8d83a18 commit b16e268

File tree

66 files changed

+823
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+823
-395
lines changed
File renamed without changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish judgeval-instrumentation-openai
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Set up Java and Maven Central Repository
13+
uses: actions/setup-java@v4
14+
with:
15+
java-version: "21"
16+
distribution: "temurin"
17+
server-id: central
18+
server-username: MAVEN_USERNAME
19+
server-password: MAVEN_PASSWORD
20+
21+
- name: Import GPG key
22+
run: |
23+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import --batch --yes
24+
echo "use-agent" >> ~/.gnupg/gpg.conf
25+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
26+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
27+
gpg-connect-agent reloadagent /bye
28+
gpg --list-secret-keys --keyid-format LONG
29+
30+
- name: Deploy judgeval-instrumentation-openai
31+
run: |
32+
mvn -B -pl instrumentation/judgeval-instrumentation-openai -am -e deploy \
33+
-Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" \
34+
-Dgpg.pinentry-mode=loopback \
35+
--update-snapshots
36+
env:
37+
MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
38+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
39+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
40+
41+
- name: Done
42+
run: echo "Published judgeval-instrumentation-openai"
43+
44+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish judgeval-java
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Set up Java and Maven Central Repository
13+
uses: actions/setup-java@v4
14+
with:
15+
java-version: "21"
16+
distribution: "temurin"
17+
server-id: central
18+
server-username: MAVEN_USERNAME
19+
server-password: MAVEN_PASSWORD
20+
21+
- name: Import GPG key
22+
run: |
23+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import --batch --yes
24+
echo "use-agent" >> ~/.gnupg/gpg.conf
25+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
26+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
27+
gpg-connect-agent reloadagent /bye
28+
gpg --list-secret-keys --keyid-format LONG
29+
30+
- name: Deploy judgeval-java
31+
run: |
32+
mvn -B -pl judgeval-java -am -e deploy \
33+
-Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" \
34+
-Dgpg.pinentry-mode=loopback \
35+
--update-snapshots
36+
env:
37+
MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
38+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
39+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
40+
41+
- name: Done
42+
run: echo "Published judgeval-java"

.github/workflows/publish.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test judgeval-instrumentation-openai
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "instrumentation/judgeval-instrumentation-openai/**"
8+
- "pom.xml"
9+
- ".github/workflows/test-instrumentation-openai.yml"
10+
11+
jobs:
12+
test-install:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Java
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: "21"
21+
distribution: "temurin"
22+
23+
- name: Cache Maven packages
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/.m2
27+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
28+
restore-keys: ${{ runner.os }}-m2
29+
30+
- name: Test Install
31+
run: |
32+
mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install
33+
34+
- name: Verify Build Artifacts
35+
run: |
36+
echo "Checking build artifacts..."
37+
ls -la instrumentation/judgeval-instrumentation-openai/target/ || true
38+
echo "JAR files:"
39+
find instrumentation/judgeval-instrumentation-openai/target -name "*.jar" -type f

.github/workflows/test-install.yml renamed to .github/workflows/test-judgeval-java.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
name: Test Install
1+
name: Test judgeval-java
22

33
on:
44
pull_request:
55
branches: [main]
6+
paths:
7+
- "judgeval-java/**"
8+
- "pom.xml"
9+
- ".github/workflows/test-judgeval-java.yml"
610

711
jobs:
812
test-install:
@@ -25,11 +29,11 @@ jobs:
2529

2630
- name: Test Install
2731
run: |
28-
mvn clean install -Dgpg.skip=true
32+
mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install
2933
3034
- name: Verify Build Artifacts
3135
run: |
3236
echo "Checking build artifacts..."
33-
ls -la target/
37+
ls -la judgeval-java/target/ || true
3438
echo "JAR files:"
35-
find target/ -name "*.jar" -type f
39+
find judgeval-java/target -name "*.jar" -type f

Makefile

Lines changed: 75 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,91 @@
1-
.PHONY: help format check test clean build generate-client
1+
.PHONY: format format-core format-openai install install-core install-openai status status-core status-openai check test clean build generate-client run
22

3-
help: ## Show this help message
4-
@echo "Available commands:"
5-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
3+
format:
4+
@echo "[format] judgeval-java"
5+
mvn -B -pl judgeval-java -am spotless:apply
6+
@echo "[format] instrumentation/judgeval-instrumentation-openai"
7+
mvn -B -pl instrumentation/judgeval-instrumentation-openai -am spotless:apply
68

7-
format: ## Format code using Spotless
8-
mvn spotless:apply
9+
format-core:
10+
mvn -B -pl judgeval-java -am spotless:apply
911

10-
check: ## Run all code quality checks
11-
mvn compile checkstyle:check spotless:check
12+
format-openai:
13+
mvn -B -pl instrumentation/judgeval-instrumentation-openai -am spotless:apply
1214

13-
test: ## Run tests
15+
check:
16+
mvn -B compile checkstyle:check spotless:check
17+
18+
test:
1419
mvn test
1520

16-
clean: ## Clean build artifacts
21+
clean:
1722
mvn clean
1823

19-
build: ## Build the project
20-
mvn clean compile
24+
build:
25+
mvn -B clean compile
26+
27+
install:
28+
@echo "[install] judgeval-java"
29+
mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install
30+
@echo "[install] instrumentation/judgeval-instrumentation-openai"
31+
mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install
32+
33+
install-core:
34+
mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install
2135

22-
install: ## Install the project
23-
mvn clean install -Dgpg.skip=true
36+
install-openai:
37+
mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install
2438

25-
generate-client: ## Generate API client from OpenAPI spec
39+
generate-client:
2640
./scripts/generate-client.sh
2741
make format
2842

29-
lint: ## Run linting only
30-
mvn checkstyle:check
43+
lint:
44+
mvn -B checkstyle:check
45+
46+
format-check:
47+
mvn -B spotless:check
48+
49+
ci:
50+
mvn -B clean compile test checkstyle:check spotless:check
51+
52+
status:
53+
$(MAKE) status-core
54+
$(MAKE) status-openai
55+
56+
status-core:
57+
@echo "[status] judgeval-java"
58+
@G=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.groupId); \
59+
A=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.artifactId); \
60+
V=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.version); \
61+
echo "GAV: $$G:$$A:$$V"; \
62+
ls -1 judgeval-java/target/*.jar 2>/dev/null || echo "No jar built"
63+
64+
status-openai:
65+
@echo "[status] instrumentation/judgeval-instrumentation-openai"
66+
@G=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.groupId); \
67+
A=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.artifactId); \
68+
V=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.version); \
69+
echo "GAV: $$G:$$A:$$V"; \
70+
ls -1 instrumentation/judgeval-instrumentation-openai/target/*.jar 2>/dev/null || echo "No jar built"
71+
72+
MAIN ?=
73+
74+
ifneq (,$(filter run,$(MAKECMDGOALS)))
75+
EXAMPLE := $(word 2,$(MAKECMDGOALS))
76+
ifeq ($(EXAMPLE),)
77+
$(error Usage: make run <example_folder> [MAIN=ClassName])
78+
endif
79+
$(eval $(EXAMPLE):;@:)
80+
endif
3181

32-
format-check: ## Check formatting without applying
33-
mvn spotless:check
3482

35-
ci: ## Run CI checks (compile, test, checkstyle, spotless)
36-
mvn clean compile test checkstyle:check spotless:check
3783

38-
run: ## Run a specific Java class with environment variables (usage: make run CLASS=com.example.MyClass)
39-
@if [ -f .env ]; then \
40-
export $$(grep -v '^#' .env | grep -v '^$$' | xargs) && mvn exec:java -Dexec.mainClass="$(CLASS)"; \
41-
else \
42-
mvn exec:java -Dexec.mainClass="$(CLASS)"; \
43-
fi
84+
run:
85+
@echo "[run] examples.$(EXAMPLE)"
86+
if [ -f .env ]; then export $$(grep -v '^#' .env | grep -v '^$$' | xargs); fi; \
87+
MAIN_CLASS=$(MAIN); \
88+
if [ -z "$$MAIN_CLASS" ]; then \
89+
MAIN_CLASS=$$(ls examples/src/main/java/examples/$(EXAMPLE)/*.java | head -n1 | xargs -n1 basename | sed 's/\.java$$//'); \
90+
fi; \
91+
mvn -q -f examples/pom.xml -DskipTests -Dexec.cleanupDaemonThreads=false -Dexec.mainClass=examples.$(EXAMPLE).$$MAIN_CLASS clean compile exec:java

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
# Judgeval Java SDK
2+
3+
[![Maven Central](https://img.shields.io/maven-central/v/com.judgmentlabs/judgeval-java)](https://central.sonatype.com/artifact/com.judgmentlabs/judgeval-java)
4+
[![javadoc](https://javadoc.io/badge2/com.judgmentlabs/judgeval-java/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java)

0 commit comments

Comments
 (0)