Skip to content

Commit

Permalink
Merge branch 'main' into open-ai-typed-models
Browse files Browse the repository at this point in the history
  • Loading branch information
raulraja authored Jun 30, 2023
2 parents f48bca3 + 6b4b66a commit c84d3ef
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions java/src/main/java/com/xebia/functional/xef/java/auto/AIScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,25 @@ public CompletableFuture<List<String>> promptMessage(String prompt, LLM.Chat llm
return future(continuation -> scope.promptMessage(prompt, llmModel, functions, user, echo, n, temperature, bringFromContext, minResponseTokens, continuation));
}

public CompletableFuture<Void> extendContext(String[] docs) {
return future(continuation -> scope.extendContext(docs, continuation))
.thenApply(unit -> null);
}

public <A> CompletableFuture<A> contextScope(Function1<AIScope, CompletableFuture<A>> f) {
return future(continuation -> scope.contextScope((coreAIScope, continuation1) -> {
AIScope nestedScope = new AIScope(coreAIScope, AIScope.this);
return FutureKt.await(f.invoke(nestedScope), continuation);
}, continuation));
}

public <A> CompletableFuture<A> contextScope(VectorStore store, Function1<AIScope, CompletableFuture<A>> f) {
return future(continuation -> scope.contextScope(store, (coreAIScope, continuation1) -> {
AIScope nestedScope = new AIScope(coreAIScope, AIScope.this);
return FutureKt.await(f.invoke(nestedScope), continuation);
}, continuation));
}

public <A> CompletableFuture<A> contextScope(List<String> docs, Function1<AIScope, CompletableFuture<A>> f) {
return future(continuation -> scope.contextScopeWithDocs(docs, (coreAIScope, continuation1) -> {
AIScope nestedScope = new AIScope(coreAIScope, AIScope.this);
Expand Down

0 comments on commit c84d3ef

Please sign in to comment.