Skip to content

.Net: Revisit namespaces and type placement #3151

@stephentoub

Description

@stephentoub

Important

Labeled Urgent because it may require a breaking change.

(Metapoint: Try rewriting all the examples without using var and seeing how many namespaces need to be imported to successfully compile.)

  • (1)
    To do anything meaningful with memory now I need both:
using Microsoft.SemanticKernel.Memory; // for ISemanticTextMemory, unless I rely exclusively on var
using Microsoft.SemanticKernel.Plugins.Memory; // for MemoryBuilder and friends

plus a using for whatever store I'm using it if it's not the VolatileMemoryStore, e.g.

using Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch;

That's three usings just to create an ISemanticTextMemory. Can these be consolidated?

  • (2)
    To do anything meaningful with planning, I now need both:
using Microsoft.SemanticKernel.Planners; // for the actual planner
using Microsoft.SemanticKernel.Planning; // for Plan

The difference between "Planners" and "Planning" is also very subtle. Can these be consolidated?

  • (3)
    It looks like Microsoft.SemanticKernel.Diagnostics exists now just for SKException, HttpOperationException, and Telemetry. Do we need this namespace at all? Can we move these types somewhere else, like moving SKException to the root Microsoft.SemanticKernel namespace?

  • (4)
    Similarly, can we consolidate Microsoft.SemanticKernel.Events with something else? "Events" is pretty broad; the types here are specific to pre/post hooks with plan execution, right?

  • (5)
    Why do we need Microsoft.SemanticKernel.Plugins.Core? Can't those just move down into Plugins?

  • (6)
    We should also move "extensions" types to the namespace with the types they extend. For example, it looks like ImageGenerationServiceExtensions, TextEmbeddingServiceExtensions, TextCompletionServiceExtensions, only have extension methods and those only apply to IAIService in Microsoft.SemanticKernel.Services... can they move there? And can they be consolidated into an AIServicesExtensions class? And OpenAIModelResultExtensions has methods that operate only on Microsoft.SemanticKernel.Orchestration.ModelResult... can it move there?

  • (7)
    What is MemoryConfiguration and why does it live in the root namespace?

  • (8)
    The main thing I do with an IKernel (which lives in the root namespace) is InvokeAsync on it, and to get a useful result from it, I need to access its KernelResult, which now lives in Microsoft.SemanticKernel.Orchestration. I suggest at least KernelResult and FunctionResult move to be next to IKernel and ISKFunction in the root namespace. And at that point, the Orchestration namespace contains very little and should likely be consolidated with something else.

  • (9)
    Microsoft.SemanticKernel.TemplateEngine contains just a single type (IPromptTemplateEngine) and then a sub Basic namespace. Can everything in Basic just move up?

  • (10)
    Microsoft.SemanticKernel.Reliability appears to solely be about HTTP and retries. Why is this separate from Microsoft.SemanticKernel.Http? Can we consolidate them?

  • (11)
    .Net: PromptTemplateConfig and IPromptTemplate namesapce refactor #3173

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codegood first issueGood for newcomerssk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)v1.0.1Required for the Semantic Kernel v1.0.1 release

Type

No type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions