Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/decisions/0021-json-serializable-custom-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Required
Not required

- **Native to Native:** Passing variables from Native to Native **will not** require any serialization or deserialization as the complex type can be passed as-is.
- **Semantic to Semantic:** Passing variables from Semantic to Semantic **will not** require any serialization or deserialization as the the complex type will be passed around using its string representation.
- **Semantic to Semantic:** Passing variables from Semantic to Semantic **will not** require any serialization or deserialization as the complex type will be passed around using its string representation.

**2. Only use native serialization methods**
This option was originally considered, which would have effectively removed the use of the `TypeConverter`s in favor of a simple `JsonConverter`, but it was pointed out that this may result in lossy conversion between primitive types. For example, when converting from a `float` to an `int`, the primitive may be truncated in a way by the native serialization methods that does not provide an accurate result.
Expand Down
4 changes: 2 additions & 2 deletions docs/decisions/0035-skfunction-type-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ informed:

## Context and Problem Statement

Today, Semantic Kernel only retains a small amount of information about the parameters of SKFunctions, and no information at all about the output of an SKFunction. This has a large negative impact on the effectiveness of our planners because it is not possible to adequately describe the schema of the the plugin function's inputs and outputs.
Today, Semantic Kernel only retains a small amount of information about the parameters of SKFunctions, and no information at all about the output of an SKFunction. This has a large negative impact on the effectiveness of our planners because it is not possible to adequately describe the schema of the plugin function's inputs and outputs.

Planners depend on a description of the plugins available to it, which we refer to as a Functions Manual. Think of this as the user manual that is provided to the LLM and is intended to explain to the LLM the functions that are available to it and how they can be used. An example of a current Functions Manual from our Sequential planner looks like this:

Expand Down Expand Up @@ -98,7 +98,7 @@ One way that we could provide the missing type information is to use Json Schema
]
```

This Functions Manual provides much more information about the the inputs and outputs of the functions that the LLM has access to. It allows to see that the output of the first functions is a complex objects that contain the information required by the second function. This also comes with an increase in the amount of tokens used, however the increase in functionality derived the type information outweighs this expense. With this information we can now expect the LLM to generate a plan that includes an understanding of how values should be extracted from outputs and passed to inputs. One effective method that we've used in testing is to ask the LLM to specify inputs as a Json Path into the appropriate output. An equivalent plan shown in pseudo code would look like this:
This Functions Manual provides much more information about the inputs and outputs of the functions that the LLM has access to. It allows to see that the output of the first functions is a complex objects that contain the information required by the second function. This also comes with an increase in the amount of tokens used, however the increase in functionality derived the type information outweighs this expense. With this information we can now expect the LLM to generate a plan that includes an understanding of how values should be extracted from outputs and passed to inputs. One effective method that we've used in testing is to ask the LLM to specify inputs as a Json Path into the appropriate output. An equivalent plan shown in pseudo code would look like this:

```csharp
var dateResponse = DatePluginSimpleComplex.GetDate1(1);
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0041-function-call-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ foreach (FunctionCallContent functionCall in functionCalls)
Questions:
- How to pass the original `FunctionCallContent` to connectors along with the function result. It's actually not clear atm whether it's needed or not. The current rationale is that some models might expect properties of the original function call, such as arguments, to be passed back to the LLM along with the function result. An argument can be made that the original function call can be found in the chat history by the connector if needed. However, a counterargument is that it may not always be possible because the chat history might be truncated to save tokens, reduce hallucination, etc.
- How to pass function id to connector?
- How to communicate exception to the connectors? It was proposed to add the `Exception` property the the `FunctionResult` class that will always be assigned by the `KernelFunction.InvokeAsync` method. However, this change will break C# function calling semantic, where the function should be executed if the contract is satisfied, or an exception should be thrown if the contract is not fulfilled.
- How to communicate exception to the connectors? It was proposed to add the `Exception` property to the `FunctionResult` class that will always be assigned by the `KernelFunction.InvokeAsync` method. However, this change will break C# function calling semantic, where the function should be executed if the contract is satisfied, or an exception should be thrown if the contract is not fulfilled.
- If `FunctionResult` becomes a non-steaming content by inheriting `KernelContent` class, how the `FunctionResult` can represent streaming content capabilities represented by the `StreamingKernelContent` class when/if it needed later? C# does not support multiple inheritance.

**Pros**
Expand Down
8 changes: 4 additions & 4 deletions docs/decisions/0048-agent-chat-serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Formalizing a mechanism that supports serialization and deserialization of any `
#### Goals
- **Capture & Restore Primary Chat History**: The primary `AgentChat` history must be captured and restored for full fidelity.
- **Capture & Restore Channel State**: In addition to the primary chat history, the state for each `AgentChannel` within the `AgentChat` must be captured and restored.
- **Capture Agent Metadata**: Capturing the agent Identifier, Name, and Type upon serialization provides a guidance on how to restore the the `AgentChat` during deserialization.
- **Capture Agent Metadata**: Capturing the agent Identifier, Name, and Type upon serialization provides a guidance on how to restore the `AgentChat` during deserialization.


#### Non-Goals
Expand All @@ -31,7 +31,7 @@ Formalizing a mechanism that supports serialization and deserialization of any `
When restoring an `AgentChat`, the application must also re-create the `Agent` instances participating in the chat (outside of the control of the deserialization process). This creates the opportunity for the following cases:

#### 1. **Equivalent:** All of the original agent types (channels) available in the restored chat.
This shall result in a full-fidelity restoration of of the original chat.
This shall result in a full-fidelity restoration of the original chat.

|Source Chat|Target Chat|
|---|---|
Expand All @@ -40,7 +40,7 @@ This shall result in a full-fidelity restoration of of the original chat.
|`ChatCompletionAgent` & `OpenAIAssistantAgent`|`ChatCompletionAgent` & `OpenAIAssistantAgent`|

#### 2. **Enhanced:** Additional original agent types (channels) available in the restored chat.
This shall also result in a full-fidelity restoration of of the original chat.
This shall also result in a full-fidelity restoration of the original chat.
Any new agent type (channel) will synchronize to the chat once restored (identical to adding a new agent type to a chat that is progress).

|Source Chat|Target Chat|
Expand All @@ -49,7 +49,7 @@ Any new agent type (channel) will synchronize to the chat once restored (identic
|`OpenAIAssistantAgent`|`ChatCompletionAgent` & `OpenAIAssistantAgent`|

#### 3. **Reduced:** A subset of original agent types (channels) available in the restored chat.
This shall also result in a full-fidelity restoration of of the original chat to the available channels. Introduction of a missing agent type (channel) post restoration will
This shall also result in a full-fidelity restoration of the original chat to the available channels. Introduction of a missing agent type (channel) post restoration will
synchronize the channel to the current chat (identical to adding a new agent type to a chat that is progress).

|Source Chat|Target Chat|
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0054-processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ The instance of `KernelProcess` that we've created is nothing more than an objec

#### Step 5 - Run the Process:

Running a Process requires using a "connector" to a supported runtime. As part of the core packages we will include an in-process runtime that is capable of of running a process locally on a dev machine or in a server. This runtime will initially use memory or file based persistence and will allow for easy development and debugging.
Running a Process requires using a "connector" to a supported runtime. As part of the core packages we will include an in-process runtime that is capable of running a process locally on a dev machine or in a server. This runtime will initially use memory or file based persistence and will allow for easy development and debugging.

Additionally we will provide support for [Orleans](https://learn.microsoft.com/en-us/dotnet/orleans/overview) and [Dapr Actor](https://docs.dapr.io/developing-applications/building-blocks/actors/actors-overview/) based runtimes which will allow customers to easily deploy processes as a distributed and highly scalable cloud based system.

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0072-agents-with-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Building a service to host an agent comes with challenges.
It's hard to build a stateful service, but service consumers expect an experience that looks stateful from the outside.
E.g. on each invocation, the user expects that the service can continue a conversation they are having.

This means that where the the service is exposing a local agent with local conversation state management (e.g. via `ChatHistory`)
This means that where the service is exposing a local agent with local conversation state management (e.g. via `ChatHistory`)
that conversation state needs to be loaded and persisted for each invocation of the service.

It also means that any memory components that may have some in-memory state will need to be loaded and persisted too.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public void GetValueCanRetrieveMEAITypes()
Assert.Same(valueType.Messages[0].Contents[0], target.GetValue<MEAI.TextContent>());
Assert.Same(valueType.Messages[0].Contents[0], target.GetValue<MEAI.AIContent>());

// Check the the content list is returned
// Check the content list is returned
Assert.Same(valueType.Messages[0].Contents, target.GetValue<IList<MEAI.AIContent>>()!);
Assert.Same(valueType.Messages[0].Contents[0], target.GetValue<IList<MEAI.AIContent>>()![0]);
Assert.IsType<MEAI.TextContent>(target.GetValue<IList<MEAI.AIContent>>()![0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ public async Task ItReturnsArgumentValueAndTypeAsync()
var functionWithNamedArgument = new CodeBlock([funcId, namedArgBlock], "");
var variable = new CodeBlock([varBlock], "");

// Assert function positional argument passed to the the function with no changes
// Assert function positional argument passed to the function with no changes
await functionWithPositionedArgument.RenderCodeAsync(this._kernel, new() { ["p1"] = expectedValue, ["var"] = expectedValue });
Assert.Same(expectedValue, canary); // Ensuring that the two variables point to the same object, as there is no other way to verify that the argument has not been transformed from object -> string -> object during the process.

// Assert function named argument passed to the the function with no changes
// Assert function named argument passed to the function with no changes
await functionWithNamedArgument.RenderCodeAsync(this._kernel, new() { ["p1"] = expectedValue, ["a1"] = expectedValue });
Assert.Same(expectedValue, canary);

Expand Down
2 changes: 1 addition & 1 deletion python/samples/demos/telemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Please refer to here on how to analyze metrics in [Azure Monitor](https://learn.

> Make sure you have the dashboard running to receive telemetry data.

Once the the sample finishes running, navigate to http://localhost:18888 in a web browser to see the telemetry data. Follow the instructions [here](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/explore) to authenticate to the dashboard and start exploring!
Once the sample finishes running, navigate to http://localhost:18888 in a web browser to see the telemetry data. Follow the instructions [here](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/explore) to authenticate to the dashboard and start exploring!

## Console output

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def main():
selection_function = KernelFunctionFromPrompt(
function_name="selection",
prompt=f"""
Determine which participant takes the next turn in a conversation based on the the most recent participant.
Determine which participant takes the next turn in a conversation based on the most recent participant.
State only the name of the participant to take the next turn.
No participant should take more than one turn in a row.

Expand Down
4 changes: 2 additions & 2 deletions python/samples/getting_started_with_processes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ The processes in this subsection contain the following modifications/additions t
###### Potato Fries Preparation With Knife Sharpening and Ingredient Stock Process

The following processes is a modification on the process [Potato Fries Preparation](#potato-fries-preparation-process)
with the the stateful steps mentioned previously.
with the stateful steps mentioned previously.

``` mermaid
flowchart LR
Expand Down Expand Up @@ -154,7 +154,7 @@ flowchart LR
###### Fried Fish Preparation With Knife Sharpening and Ingredient Stock Process

The following process is a modification on the process [Fried Fish Preparation](#fried-fish-preparation-process)
with the the stateful steps mentioned previously.
with the stateful steps mentioned previously.

``` mermaid
flowchart LR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Next, as an environment variable or in the .env file, add the `poolManagementEnd
https://eastus.acasessions.io/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroup}}/sessionPools/{{sessionPool}}/python/execute
```

You can also provide the the `ACA_TOKEN_ENDPOINT` if you want to override the default value of `https://acasessions.io/.default`. If this token endpoint doesn't need to be overridden, then it is
You can also provide the `ACA_TOKEN_ENDPOINT` if you want to override the default value of `https://acasessions.io/.default`. If this token endpoint doesn't need to be overridden, then it is
not necessary to include this as an environment variable, in the .env file, or via the plugin's constructor. Please follow the [Azure Container Apps Documentation](https://learn.microsoft.com/en-us/azure/container-apps/sessions-code-interpreter) to review the proper role required to authenticate with the `AsyncTokenCredential`.

Next, let's move on to implementing the plugin in code. It is possible to add the code interpreter plugin as follows:
Expand Down
4 changes: 2 additions & 2 deletions python/semantic_kernel/functions/kernel_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async def __call__(

@abstractmethod
async def _invoke_internal(self, context: FunctionInvocationContext) -> None:
"""Internal invoke method of the the function with the given arguments.
"""Internal invoke method of the function with the given arguments.

This function should be implemented by the subclass.
It relies on updating the context with the result from the function.
Expand Down Expand Up @@ -298,7 +298,7 @@ async def invoke(

@abstractmethod
async def _invoke_internal_stream(self, context: FunctionInvocationContext) -> None:
"""Internal invoke method of the the function with the given arguments.
"""Internal invoke method of the function with the given arguments.

The abstract method is defined without async because otherwise the typing fails.
A implementation of this function should be async.
Expand Down
Loading