Skip to content

Conversation

adrianwyatt
Copy link
Contributor

No description provided.

lemillermicrosoft and others added 19 commits April 4, 2023 11:04
### Motivation and Context
We are working to update Planning to be object based rather than skill
based, to help abstract the semantic structure of plans (XML, etc.) away
from users into an abstract syntax tree. This will make it so developers
do not have to parse and modify XML manually and enable developers to
create their own plan and plan generators that can be executed by the
kernel.

### Description
This changes adds the following classes and interfaces to the
SemanticKernel.Planning namespace:

- IPlan: An interface that represents a plan for achieving a goal using
a semantic kernel.
- BasePlan: A base class that implements the IPlan interface with some
default properties and methods.
- PlanStep: A class that represents a single step in a plan, including
the description, the selected skill and function, the named parameters,
the output and result keys, and the optional children steps.
- KernelPlanningExtensions: A static class that provides extension
methods for running a plan using an IKernel instance.
- Renames the Plan class to SkillPlan, to avoid confusion with the
PlanExecution class and other types of plans in the SemanticKernel
namespace
### Motivation and Context
Fix the build

### Description
This commit adds a pragma directive to suppress the IDE0130 warning that
suggests using the file name as the namespace for the
KernelPlanningExtensions.cs file. This warning is not applicable for
extension methods, as they need to be in the same namespace as the type
they are extending. The commit also adds a using directive for the
Microsoft.SemanticKernel.Planning namespace, which is needed for the
extension methods.
Simple fixes, dictionary words and methods visibility
### Motivation and Context
Skill.cs was not used at all

### Description
Remove Skill.cs
Update README with latest syntax from new nuget
### Motivation and Context

Currently, the core planner doesn’t support conditional behavior. 
This design offers an initial “If” statement capability skill that
allows planner control flow execution conditioned to check for
`equals`/`contains`/`greaterthan`/`lessthan` and other semantic
conditions that are not described but the LLM can interpret correctly,
like negation `not equals` or `different`, `is undefined`, `is not
undefined` against context variables.

This change will allow Plan to run correctly for prompts like: `If is
still morning please give me a joke about coffee otherwise tell me one
about afternoon, but if its night give me a poem about the moon`

### Description

This change adds a conditional structure to the plan as a way to be able
to use a standard conditional structure for branching that can be
recursive as follows.

Structure:
```
<plan>
  ... plan steps
  <if condition="$variable1 equals|contains|greaterthan value" />
     ... plan steps
  </if>
  <else> (Optional)
      ... plan steps
      <if /> (nested ifs)
      <else /> (Optional nested if's else's)
  </else>
</plan>
```

When resolving the conditional group this returns to the plan the
content inside `if` if `TRUE` or inside `else` if `FALSE` and plan
continues going through one of those branches (if or else) and repeat
the behavior if another `if` structure is found.

This structure was build in a way that it can allow nested complex
conditions and checks like:
```
<if condition="$variable1 equals 1 OR ($variable2 contains 'something' AND $variable3 lessthan 10) AND $variable4 is not undefined">
    <function.SKillX.FunctionY />
</if>
```
### Motivation and Context

Show how to use ChatGPT chat API and DALL-E 2 image generation API.

Note: the notebooks and SK currently work only with OpenAI.

### Description

Added two new C# notebooks.
### Motivation and Context
Make sure CodeQL checks are done for all experimental branches.


### Description
Updated the branch specifier to "experimental*"
### Motivation and Context

This PR adds support for request headers for OpenApi skills and applies
a few fixes/improvements to the functionality of building request url so
that the following scenarios are supported and can function properly:
- OpenApi skill declares a header parameter ("in": "header") to provide
additional information to the request being made via HTTP headers.
Currently, it's not supported, and this PR adds support for single
header values only. Support for multiple values (comma separated ones)
will be prioritized and added later.
- OpenApi skill declares query string parameters to pass additional
data/info via url. The current implementation encloses string-type query
string parameter values in single quotes, which leads to 400 HTTP
errors. Additionally, the values are not encoded. The PR fixes these two
problems.

### Description

To add headers, the following classes were changed:
- OpenApiDocumentParser - is extended to be able to extract headers
metadata from OpenApi document and assign it to RestApiOperation
Properties and Headers collections.
- RestApiOperation - became capable of rendering the headers based on
header metadata (isRequered, defaultValue, ...) and provided arguments.
- RestApiOperationRunner - delegates the headers rendering to
RestApiOperation class and use the rendered headers to send HTTP
request.
### Motivation and Context

Some users are reporting errors with the new notebooks that use
SkiaSharp, because the nuget version is not explicitly stated in the
code.

### Description

Specify which version of SkiaSharp to use.
### Motivation and Context
The OpenAPI skill accepts a callback function as a parameter, to be used
for adding auth info to HTTP requests before sending. In the simplest
scenario, the caller would have an access token to add to the requests.
This change provides a class/function that callers can use to pass a
pre-acquired token to the HTTP request's auth header, and also serves as
a reference for future OpenAPI auth providers.

### Description
Implement the TokenAuthenticationProvider class. The constructor accepts
an access token, which is added to the HTTP request message provided
when calling AuthenticateRequestAsync. The function signature matches
the signature of the AuthenticateRequestAsyncCallback delegate type.
…ics, Move Vector Stores to Connectors (#308)

### Motivation and Context
Existing memory interfaces are overly complicated, leading to confusion
about how to implement a custom Memory Store.

This PR condenses `IMemoryStore` + `IEmbeddingIndex` + `IDataStore `->
**`IMemoryStore`** and eliminates the use of generics spread by the
Embedding struct. It makes the codebase much easier to read and
IMemoryStore easier to implement. As part of the effort,
SqliteMemoryStore was properly implemented (it was not previously).

Additionally, this PR moves the MemoryStore 'skills' to the connectors
namespace.

Addresses several points called out in
#202

### Description

- `QdrantMemoryStore` was moved from Skills to Connectors. Unit tests
were added for the memory store object. Created an IQdrantVectorDbClient
interface to better enable testing of the memory store through mocks.
- Modified QdrantVectorDbClient calls to default batched calls to
reduced the amount of HTTP traffic when possible. `GetVectorById ->
GetVectorsById`, `UpsertVector -> UpsertVectors`, `DeleteVector ->
DeleteVectors`.
- Generally, for a vector store, the unique id passed by the user to
associate with a saved memory will become the indexed ID for the vector
store as well. However, Qdrant enforces a user-provided GUID or hex
string as the index key. Added a nullable key field to `MemoryRecord` to
support vector storage services that act similarly. Depending on the
backing storage, this key is not necessary to pass to subsequent calls.
`SemanticTextMemory` does not utilized this parameter. For now, this is
only for direct interaction with the `QdrantMemoryStore`. **Note**: It
is understood that Qdrant will be enabling service-side GUID generation
in the near future, significantly reducing the stress on the client to
produce unique values for every data entry.
- Eliminated the dependency on the core kernel in the connectors by
replacing `Embeddings` struct references with `IEnumerable<float>`.
- `SqliteMemoryStore` was moved from Skills to Connectors.
`SqliteMemoryStore` now properly implements `IMemoryStore` and the unit
tests were updated to reflect this fact.
- The generic `TEmbedding` was removed from all Kernel and Connector
files. **If a memory store expects a non-FP32 vector, it is currently up
to the `IMemoryStore` implementation to perform the necessary
conversions.**
- `DataEntry` is now a base class that enforces nullable Key and
Timestamp fields. It is not strictly used for anything other than
MemoryRecord. It may serve useful for connecting to data stores that are
for structures other than embeddings, or vector stores that calculate
embeddings server-side.
- Removed existing collection checks for `Upsert` calls. Depending on
the implementation, this has the potential to drastically increase HTTP
traffic or local compute resources when making batch calls. The call has
been moved to SemanticTextMemory for now to avoid additional breaking
changes, but will be addressed in a better fashion in a follow-up PR.
- Added a very simple example to `KernelSyntaxExamples `on how to create
a read-only `IMemoryStore` that imports vectors from a json string.
- Renamed `VectorDbException` -> `QdrantMemoryException`. Ensured that
these exceptions can only be thrown by the `QdrantMemoryStore` and can
accept an inner exception as a paramter.

Additional small edits:
- removed unnecessary namespace from KernelSyntaxExamples Example21 and
Example22
- Removed unused references in `RestApiOperations.cs` and
`JsonPathSkill.cs`

---------------- OUT OF SCOPE, COMING SOON ----------------
- The addition of a value string to MemoryRecord. This is very important
for metadata flexibility, but it will come in a follow-up PR.
- The ability to optionally return the vector to the user. In many
cases, the vector is not important for get/search calls, thus it makes
no sense to pass such large amounts of data around the kernel
application.
- Disambiguation of SemanticTextMemory interfaces, classes, and
constructors.
- Unit tests for QdrantVectorDbClient. Qdrant will be making breaking
changes to their API very soon. TBD whether integration tests will be
added as well.
### Motivation and Context / Description

This is a minor change/update following #341 --
TokenAuthenticationProvider should accept an async function pointer for
the access token.
### Motivation and Context
Adding extra details to error messages surfaced when models fail to
load.
Response to issue here:
#326

### Description
If response body is null on failure (i.e., on 500 Internal Server Error
or some 4xx errors), we will surface the status code for more context.
Otherwise, generic fetch error message is shown.
Also, constructing URL using URL class to ensure appropriate paths and
forward slashes
### Motivation and Context
Fix warnings in main build and apply formatting fixes from R#.

### Description
Fix build warnings and R# formatting.
@adrianwyatt adrianwyatt merged commit a6044e7 into feature-refapp Apr 6, 2023
@dluc dluc deleted the feature-refapp-merge branch April 7, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants