Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Jun 11, 2024
1 parent eadfe07 commit 5ea0933
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.stefanbratanov.jvm.openai;

import io.github.stefanbratanov.jvm.openai.ToolResources.FileSearch.VectorStores;
import io.github.stefanbratanov.jvm.openai.ToolResources.FileSearch.VectorStore;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand All @@ -14,9 +14,9 @@ public record CodeInterpreter(List<String> fileIds) {}
* Either {@link #vectorStoreIds} or {@link #vectorStores} must be present, but not both of them.
*/
public record FileSearch(
Optional<String[]> vectorStoreIds, Optional<VectorStores[]> vectorStores) {
Optional<String[]> vectorStoreIds, Optional<VectorStore[]> vectorStores) {

public record VectorStores(
public record VectorStore(
Optional<List<String>> fileIds,
Optional<ChunkingStrategy> chunkingStrategy,
Optional<Map<String, String>> metadata) {
Expand Down Expand Up @@ -56,8 +56,8 @@ public Builder metadata(Map<String, String> metadata) {
return this;
}

public VectorStores build() {
return new VectorStores(fileIds, chunkingStrategy, metadata);
public VectorStore build() {
return new VectorStore(fileIds, chunkingStrategy, metadata);
}
}
}
Expand All @@ -71,7 +71,7 @@ public static ToolResources fileSearchToolResources(String... vectorStoreIds) {
return new ToolResources(null, new FileSearch(Optional.of(vectorStoreIds), Optional.empty()));
}

public static ToolResources fileSearchToolResources(VectorStores... vectorStores) {
public static ToolResources fileSearchToolResources(VectorStore... vectorStores) {
return new ToolResources(null, new FileSearch(Optional.empty(), Optional.of(vectorStores)));
}

Expand All @@ -83,7 +83,7 @@ public static ToolResources codeInterpreterAndFileSearchToolResources(
}

public static ToolResources codeInterpreterAndFileSearchToolResources(
List<String> fileIds, VectorStores... vectorStores) {
List<String> fileIds, VectorStore... vectorStores) {
return new ToolResources(
new CodeInterpreter(fileIds), new FileSearch(Optional.empty(), Optional.of(vectorStores)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.github.stefanbratanov.jvm.openai.ToolCall.CodeInterpreterToolCall.CodeInterpreter;
import io.github.stefanbratanov.jvm.openai.ToolCall.CodeInterpreterToolCall.CodeInterpreter.Output.ImageOutput;
import io.github.stefanbratanov.jvm.openai.ToolCall.FunctionToolCall;
import io.github.stefanbratanov.jvm.openai.ToolResources.FileSearch.VectorStores;
import io.github.stefanbratanov.jvm.openai.ToolResources.FileSearch.VectorStore;
import java.util.*;
import java.util.function.IntFunction;
import java.util.function.Supplier;
Expand Down Expand Up @@ -612,13 +612,13 @@ public CreateVectorStoreRequest randomCreateVectorStoreRequest() {
.build();
}

public VectorStore randomVectorStore() {
return new VectorStore(
public io.github.stefanbratanov.jvm.openai.VectorStore randomVectorStore() {
return new io.github.stefanbratanov.jvm.openai.VectorStore(
randomString(5),
randomLong(5, 10_000),
randomString(7),
randomLong(100, 100_000),
new VectorStore.FileCounts(
new io.github.stefanbratanov.jvm.openai.VectorStore.FileCounts(
randomInt(0, 10),
randomInt(0, 10),
randomInt(0, 10),
Expand Down Expand Up @@ -808,19 +808,19 @@ private Images.Image randomImage() {
private ToolResources randomToolResources(boolean includeVectorStores) {
List<String> fileIds = listOf(randomInt(1, 20), () -> randomString(7));
String[] vectorStoreIds = arrayOf(1, () -> randomString(7), String[]::new);
VectorStores[] vectorStores =
VectorStore[] vectorStores =
arrayOf(
1,
() ->
VectorStores.newBuilder()
VectorStore.newBuilder()
.fileIds(listOf(randomInt(1, 10_000), () -> randomString(7)))
.chunkingStrategy(
oneOf(
ChunkingStrategy.autoChunkingStrategy(),
randomStaticChunkingStrategy()))
.metadata(randomMetadata())
.build(),
VectorStores[]::new);
VectorStore[]::new);
if (includeVectorStores) {
return oneOf(
ToolResources.codeInterpreterToolResources(fileIds),
Expand Down

0 comments on commit 5ea0933

Please sign in to comment.