mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
@@ -1,6 +1,14 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
package com.microsoft.semantickernel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.microsoft.semantickernel.builders.SemanticKernelBuilder;
|
||||
import com.microsoft.semantickernel.contextvariables.ContextVariableType;
|
||||
import com.microsoft.semantickernel.hooks.KernelHooks;
|
||||
@@ -16,13 +24,8 @@ import com.microsoft.semantickernel.services.AIServiceSelection;
|
||||
import com.microsoft.semantickernel.services.AIServiceSelector;
|
||||
import com.microsoft.semantickernel.services.OrderedAIServiceSelector;
|
||||
import com.microsoft.semantickernel.services.ServiceNotFoundException;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Provides state for use throughout a Semantic Kernel workload.
|
||||
@@ -276,6 +279,9 @@ public class Kernel {
|
||||
@Nullable
|
||||
private Function<AIServiceCollection, AIServiceSelector> serviceSelectorProvider;
|
||||
|
||||
/**
|
||||
* Construct a Builder for creating a new instance of {@code Kernel}.
|
||||
*/
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
|
||||
+54
-2
@@ -1,29 +1,81 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
package com.microsoft.semantickernel.orchestration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Configuration settings for prompt execution.
|
||||
*/
|
||||
public class PromptExecutionSettings {
|
||||
|
||||
/**
|
||||
* The default for {@link #getServiceId()} if a
|
||||
* {@link Builder#withServiceId(String) service id} is not provided.
|
||||
* Defaults to {@code "default"}
|
||||
*/
|
||||
public static final String DEFAULT_SERVICE_ID = "default";
|
||||
|
||||
/**
|
||||
* The default for {@link #getMaxTokens()} if
|
||||
* {@link Builder#withMaxTokens(int) max_tokens} is not provided.
|
||||
* Defaults to {@code 256}
|
||||
*/
|
||||
public static final Integer DEFAULT_MAX_TOKENS = 256;
|
||||
|
||||
/**
|
||||
* The default for {@link #getTemperature()} if
|
||||
* {@link Builder#withTemperature(double) temperature} is not provided.
|
||||
* Defaults to {@code 1.0}
|
||||
*/
|
||||
public static final Double DEFAULT_TEMPERATURE = 1.0;
|
||||
|
||||
/**
|
||||
* The default for {@link #getTopP()} if
|
||||
* {@link Builder#withTopP(double) top_p} is not provided.
|
||||
* Defaults to {@code 1.0}
|
||||
*/
|
||||
public static final Double DEFAULT_TOP_P = 1.0;
|
||||
|
||||
/**
|
||||
* The default for {@link #getPresencePenalty()} if
|
||||
* {@link Builder#withPresencePenalty(double) presence_penalty} is not provided.
|
||||
* Defaults to {@code 0.0}
|
||||
*/
|
||||
public static final Double DEFAULT_PRESENCE_PENALTY = 0.0;
|
||||
|
||||
/**
|
||||
* The default for {@link #getFrequencyPenalty()} if
|
||||
* {@link Builder#withMaxTokens(doulbe) frequency_penalty} is not provided.
|
||||
* Defaults to {@code 0.0}
|
||||
*/
|
||||
public static final Double DEFAULT_FREQUENCY_PENALTY = 0.0;
|
||||
|
||||
/**
|
||||
* The default for {@link #getBestOf()} if
|
||||
* {@link Builder#withBestOf(int) best_of} is not provided.
|
||||
* Defaults to {@code 1}
|
||||
*/
|
||||
public static final Integer DEFAULT_BEST_OF = 1;
|
||||
|
||||
/**
|
||||
* The default for {@link #getResultsPerPrompt()} if
|
||||
* {@link Builder#withResultsPerPrompt(int) results per prompt (n)} is not provided.
|
||||
* Defaults to {@code 1}
|
||||
*/
|
||||
public static final Integer DEFAULT_RESULTS_PER_PROMPT = 1;
|
||||
|
||||
//
|
||||
// Keys used as both @JsonProperty names and keys to the Builder's value map.
|
||||
//
|
||||
private static final String SERVICE_ID = "service_id";
|
||||
private static final String MODEL_ID = "model_id";
|
||||
private static final String TEMPERATURE = "temperature";
|
||||
|
||||
+7
-2
@@ -1,15 +1,16 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
package com.microsoft.semantickernel.orchestration;
|
||||
|
||||
import com.microsoft.semantickernel.semanticfunctions.KernelFunction;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.microsoft.semantickernel.semanticfunctions.KernelFunction;
|
||||
|
||||
/**
|
||||
* Defines the behavior of a tool call. Currently, the only tool available is function calling.
|
||||
*/
|
||||
@@ -131,6 +132,10 @@ public class ToolCallBehavior {
|
||||
this.requiredFunction = requiredFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the required function.
|
||||
* @return the required function.
|
||||
*/
|
||||
public KernelFunction<?> getRequiredFunction() {
|
||||
return requiredFunction;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user