Skip to content

Commit

Permalink
Refactor Examples, updated readme (#174)
Browse files Browse the repository at this point in the history
In this PR:
* Moved ITextRequestRouter and VectorTextIndex into typechat.examplesLib
  • Loading branch information
umeshma authored Oct 7, 2023
1 parent ce53545 commit e6dfc70
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ The following examples demonstrate how to use JsonTranslator, Schemas and Vocabu

### Hierarchical schemas
* [MultiSchema](./examples/MultiSchema): dynamically route user intent to other 'sub-apps'
* [SchemaHierarchy](./examples/SchemaHierarchy): A Json Translator than uses multiple child JsonTranslators

These examples also how [TextClassification](./examples/typechat.examplesLib/Classification) classes can be used to route text inputs to handlers.
* [SchemaHierarchy](./examples/SchemaHierarchy): A Json Translator than uses multiple child JsonTranslators. For each user request, it picks the semantically ***nearest*** child translator and routes the input to it.
* [TextClassification](./examples/typechat.examplesLib/Classification) and [VectorTextIndex](./examples/typechat.examplesLib/VectorTextIndex.cs) show how to build a simple classifiers to route input.

### Json Programs

Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions examples/typechat.examplesLib/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Example classes include:

* **HierarchicalJsonTranslator**: demonstrates how a translator can use an in-memory vector index to semantically route request to child translators

* **VectorizedTextIndex**: Demonstrates how to use an in-memory vectorized text index to route text requests

* **PluginProgramTranslator**: Program translator that translates user requests into programs that call APIs defined by Microsoft Semantic Kernel Plugins

* **PluginProgramValidator**: Validates programs produced by PluginProgramTranslator
Expand Down
File renamed without changes.
16 changes: 7 additions & 9 deletions src/typechat/Typescript.cs → src/typechat/Schema/Typescript.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

using Microsoft.TypeChat.Schema;

namespace Microsoft.TypeChat;
namespace Microsoft.TypeChat.Schema;

/// <summary>
/// Terminals, Operators etc, used to export Typescript
Expand Down Expand Up @@ -56,31 +54,31 @@ public static class Types
{
if (type.IsString())
{
return Types.String;
return String;
}
else if (type.IsEnum)
{
return null;
}
else if (type.IsNumber())
{
return Types.Number;
return Number;
}
else if (type.IsBoolean())
{
return Types.Boolean;
return Boolean;
}
else if (type.IsDateTime())
{
return Types.String; // Json does not have a primitive DateTime
return String; // Json does not have a primitive DateTime
}
else if (type.IsObject())
{
return Types.Any;
return Any;
}
else if (type.IsVoid())
{
return Types.Void;
return Void;
}
return null;
}
Expand Down

0 comments on commit e6dfc70

Please sign in to comment.