Skip to content
Merged
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
42 changes: 42 additions & 0 deletions .github/_typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Typos configuration file
#
# Info: https://github.com/marketplace/actions/typos-action
# Install: brew install typos-cli
# Install: conda install typos
# Run: typos -c .github/_typos.toml

[files]
extend-exclude = [
"_typos.toml",
]

[default.extend-words]
ACI = "ACI" # Azure Container Instance

[default.extend-identifiers]
ags = "ags" # Azure Graph Service

[type.jupyter]
extend-ignore-re = [
'"[A-Fa-f0-9]{8}"', # cell id strings
]

[type.csharp]
extend-ignore-re = [
"caf", # intentional typo in the examples
]

[type.json]
extend-ignore-re = [
"caf", # intentional typo in the examples
]

[type.txt]
extend-ignore-re = [
"caf", # intentional typo in the examples
]

[type.msbuild]
extend-ignore-re = [
'Version=".*"', # ignore package version numbers
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# each targeting a single version of the dotnet SDK.
#

name: dotnet-build-test
name: build-unittest

on:
workflow_dispatch:
Expand All @@ -20,16 +20,16 @@ permissions:
contents: read

jobs:
dotnet-build-test:
build-unittest:
strategy:
fail-fast: false
matrix:
include:
# - { dotnet: '6.0-jammy', os: 'ubuntu', configuration: Debug }
# - { dotnet: '6.0-jammy', os: 'ubuntu', configuration: Debug }
- { dotnet: '7.0-jammy', os: 'ubuntu', configuration: Debug }
- { dotnet: '7.0-jammy', os: 'ubuntu', configuration: Release }
- { dotnet: '8.0-preview-jammy', os: 'ubuntu', configuration: Release }
# - { dotnet: '6.0', os: 'windows', configuration: Release }
# - { dotnet: '6.0', os: 'windows', configuration: Release }
- { dotnet: '7.0', os: 'windows', configuration: Debug }
- { dotnet: '7.0', os: 'windows', configuration: Release }
- { dotnet: '8.0-preview', os: 'windows', configuration: Release }
Expand All @@ -53,7 +53,4 @@ jobs:

- name: Run Tests
run: |
export UT_PROJECTS=$(find ./ -type f -name "*.UnitTests.csproj" | tr '\n' ' ')
for project in $UT_PROJECTS; do
dotnet test -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx
done
dotnet test -c ${{ matrix.configuration }} tests/TypeChat.UnitTests/TypeChat.UnitTests.csproj --no-build -v Normal --logger trx
62 changes: 62 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# This workflow will build and run all unit tests using dotnet docker containers,
# each targeting a single version of the dotnet SDK.
#

name: build-integrationtest

on:
workflow_dispatch:
pull_request:
branches: [ "main" ]
merge_group:
branches: ["main"]
schedule:
- cron: "0 7 * * *" # Run at midnight PDT every day

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build-integrationtest:
strategy:
fail-fast: false
matrix:
include:
- { dotnet: '7.0-jammy', os: 'ubuntu', configuration: Release }

runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }}
env:
NUGET_CERT_REVOCATION_MODE: offline
GITHUB_ACTIONS: 'true'

steps:
- uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request' }}
with:
clean: true

- name: Build dotnet solutions
if: ${{ github.event_name != 'pull_request' }}
run: |
export SOLUTIONS=$(find ./ -type f -name "*.sln" | tr '\n' ' ')
for solution in $SOLUTIONS; do
dotnet build -c ${{ matrix.configuration }} /warnaserror $solution
done

- name: Run Tests
shell: bash
if: ${{ github.event_name != 'pull_request' }}
env: # Set Azure credentials secret as an input
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_ENDPOINT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_API_KEY }}
OPENAI_MODEL: ${{ secrets.AZURE_COMPLETION_MODEL }}
OPENAI_EMBEDDINGMODEL: ${{ secrets.AZURE_COMPLETION_MODEL }}
run: |
dotnet test -c ${{ matrix.configuration }} tests/TypeChat.IntegrationTests/TypeChat.IntegrationTests.csproj --no-build -v Normal --logger trx
29 changes: 29 additions & 0 deletions .github/workflows/spell_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Check pull requests for typos.
#
# Configuration: .github/_typos.toml
#
# Info: https://github.com/marketplace/actions/typos-action
# Local install: brew install typos-cli
# Local install: conda install typos
# Local run: typos -c .github/_typos.toml

name: Spell Check

on:
workflow_dispatch:
pull_request:
branches: [ "main" ]

jobs:
run:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Use custom config file
uses: crate-ci/typos@master
with:
config: .github/_typos.toml
write_changes: false
2 changes: 1 addition & 1 deletion examples/MultiSchema/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This application demonstrates a simple way to write a **super-app** that automatically routes user requests to child apps.

In this example, the child apps are existng Typechat chat examples:
In this example, the child apps are existing Typechat chat examples:
* CoffeeShop
* Restaurant
* Calendar
Expand Down
2 changes: 1 addition & 1 deletion examples/SchemaHierarchy/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Schema Hierarchy

This application demonstrates how to implement hierarchical schema usin g a [HierarchicalJsonTranslator](HierarchicalJsonTranslator.cs).
This application demonstrates how to implement hierarchical schema using a [HierarchicalJsonTranslator](HierarchicalJsonTranslator.cs).

The HierarchicalJsonTranslator automatically picks the best child schema for a request using embedings. Sub-schemas are:
* CoffeeShop
Expand Down
2 changes: 1 addition & 1 deletion src/package/NUGET.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ TypeChat.NET provides **cross platform** libraries that help you build natural l

# Getting Started

Learn about and get the latest updates on the TypeChat.NET porject on the [TypeChat.NET GitHub repository](https://github.com/microsoft/typechat.net).
Learn about and get the latest updates on the TypeChat.NET project on the [TypeChat.NET GitHub repository](https://github.com/microsoft/typechat.net).
2 changes: 1 addition & 1 deletion src/typechat.dialog/IContextProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Microsoft.TypeChat.Dialog;

/// <summary>
/// Applications that work the language models typically need dynamic retrieval of context pertinent to a
/// particular reques. This is the so called RAG pattern.
/// particular request. This is the so called RAG pattern.
/// </summary>
public interface IContextProvider
{
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.dialog/ITextSerializable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.TypeChat.Dialog;
public interface ITextSerializable
{
/// <summary>
/// Turn this object into a string. The string output may be differen from what ToString() produces
/// Turn this object into a string. The string output may be different from what ToString() produces
/// </summary>
/// <returns>string</returns>
string Stringify();
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.dialog/MessageList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public MessageList(int capacity = 4)
/// <returns>count</returns>
public int GetCount() => Count;
/// <summary>
/// All messsages in this message stream
/// All messages in this message stream
/// </summary>
/// <returns>An enumeration of messages</returns>
public IEnumerable<Message> All() => this;
Expand Down
4 changes: 2 additions & 2 deletions src/typechat.dialog/PromptBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.TypeChat;
/// <summary>
/// Prompts have a maximum length. Prompt lengths are be limited by model capacity or policy
/// PromptBuilder builds prompts consisting of multiple prompt sections in a way that the prompt
/// length does not exceeed a given maximum
/// length does not exceed a given maximum
/// </summary>
public class PromptBuilder
{
Expand All @@ -30,7 +30,7 @@ public PromptBuilder(int maxLength)
/// boundaries and so on.
/// </summary>
/// <param name="maxLength">Prompt will not exceed this maxLengthin characters</param>
/// <param name="substringExtractor">optinal extractor</param>
/// <param name="substringExtractor">optional extractor</param>
public PromptBuilder(int maxLength, Func<string, int, string>? substringExtractor = null)
{
_prompt = new Prompt();
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.examplesLib/HierarchicalJsonTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Microsoft.TypeChat;

/// <summary>
/// Some scenarios have schemas that can be partioned into sub-schemas or translators.
/// Some scenarios have schemas that can be partitioned into sub-schemas or translators.
/// Language models have token limits, which means we must do a first pass and route requests to the appropriate target
/// It may also be necessary to bind to these translators dynamically
///
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.program/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ dynamic[] CreateCallArgs(string name, dynamic[] jsonArgs, ParameterInfo[] params
{
return EmptyArgs;
}
// If any of input paramters are JsonObjects, deserialize them
// If any of input parameters are JsonObjects, deserialize them
ConvertObjects(jsonArgs, paramsInfo);
return jsonArgs;
}
Expand Down
4 changes: 2 additions & 2 deletions src/typechat.program/ProgramException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum ErrorCode
// Program JSON does not contain a valid program
InvalidProgramJson,
JsonValueTypeNotSupported,
TypeMistmatch, // There was a type mismatch when attempting to call a function
TypeMismatch, // There was a type mismatch when attempting to call a function
InvalidResultRef, // Invalid Reference to a result returned by a program step
ArgCountMismatch, //
FunctionNotFound, // No such function in the target Api
Expand Down Expand Up @@ -56,7 +56,7 @@ internal static void ThrowTypeMismatch(FunctionCall call, ParameterInfo param, T
internal static void ThrowTypeMismatch(string name, ParameterInfo param, Type actual)
{
throw new ProgramException(
ProgramException.ErrorCode.TypeMistmatch,
ProgramException.ErrorCode.TypeMismatch,
$"TypeMismatch: @func {name} @arg {param.Name}: Expected {param.ParameterType.Name}, Got {actual.Name}"
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/typechat.program/ProgramInterpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ProgramInterpreter()

/// <summary>
/// Runs the given program by evaluating each node in the Program AST
/// Evaulates any FunctionCalls by invoking the callHandler callback
/// Evaluates any FunctionCalls by invoking the callHandler callback
/// </summary>
/// <param name="program">program to run</param>
/// <param name="callHandler">handler that will actually make function calls</param>
Expand All @@ -51,7 +51,7 @@ public ProgramInterpreter()

/// <summary>
/// Asynchronously run the given program by evaluating each node in the Program AST
/// Evaulates any FunctionCalls by invoking the callHandler callback
/// Evaluates any FunctionCalls by invoking the callHandler callback
/// </summary>
/// <param name="program">program to run</param>
/// <param name="callHandlerAsync">handler that will actually make function calls</param>
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.program/ProgramTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static TypescriptSchema GetProgramSchema()
/// <summary>
/// Create a program translator that uses the given language model to create programs
/// that can call the given API. The API is the interface or class definition, whose methods
/// and method sigatures define the API surface.
/// and method signatures define the API surface.
/// </summary>
/// <param name="model">language model</param>
/// <param name="validator">Validator that verifies the returned program</param>
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.program/ProgramWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Microsoft.TypeChat;

/// <summary>
/// Simple Program writer: writes out Program as a psuedo C# like function
/// Simple Program writer: writes out Program as a pseudo C# like function
/// Useful for displaying programs to a user
/// </summary>
public class ProgramWriter
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.sk/Embeddings/Embedding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void NormalizeInPlace()
/// Compute the cosine similarity between this and other
/// </summary>
/// <param name="other">other embedding</param>
/// <returns>cosine similiarity</returns>
/// <returns>cosine similarity</returns>
public double CosineSimilarity(Embedding other)
{
return _vector.CosineSimilarity(other._vector);
Expand Down
2 changes: 1 addition & 1 deletion src/typechat.sk/VectorTextIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public async Task AddAsync(T item, string textRepresentation, CancellationToken
/// If the associated embedding model supports batching, this can be much faster
/// </summary>
/// <param name="items">items to add to the collection</param>
/// <param name="textRepresentations">the text represenations of these items</param>
/// <param name="textRepresentations">the text representations of these items</param>
/// <param name="cancelToken">optional cancel token</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="InvalidOperationException"></exception>
Expand Down
2 changes: 1 addition & 1 deletion src/typechat/Classification/TextRequestRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public TextRequestRouter(TextClassifier classifier)
/// <summary>
/// Add a route
/// : nameOfTarget should be unique and typically short
/// : description describes what kind of natural rquests should be routed to this target
/// : description describes what kind of natural requests should be routed to this target
/// </summary>
/// <param name="target">potential target for requests. Can be null for ignore routes</param>
/// <param name="nameOfTarget">short, unique name of the target</param>
Expand Down
2 changes: 1 addition & 1 deletion src/typechat/IJsonTranslatorPrompts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Microsoft.TypeChat;

/// <summary>
/// Json Translators use a request Prompt and a repair Prompt. This interface lets you custoize both.
/// Json Translators use a request Prompt and a repair Prompt. This interface lets you customize both.
/// A repair prompt
/// </summary>
public interface IJsonTranslatorPrompts
Expand Down
2 changes: 1 addition & 1 deletion src/typechat/IPromptSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface IPromptSection
{
/// <summary>
/// The source of this prompt section
/// Typical sources - user, system and assitant - are defined in PromptSection.Sources
/// Typical sources - user, system and assistant - are defined in PromptSection.Sources
/// </summary>
public string? Source { get; }
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/typechat/JsonTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.TypeChat;
/// - JsonTranslator can automatically generate Typescript schema for T. But you can also create schema in other ways.
/// - The model returns JSON.
/// - JsonTranslator uses Validators to validate and deserialize the returned JSON into a valid object of type T
/// - Optional ConstraintsValidators can also futher valdidate the object
/// - Optional ConstraintsValidators can also further valdidate the object
///
/// Since language models are stochastic, the returned JSON can have errors or fail type checks.
/// When this happens, JsonTranslator tries to REPAIR the JSON by sending translation errors back to the language model.
Expand Down
2 changes: 1 addition & 1 deletion src/typechat/Schema/CodeWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CodeWriter Write(string token)
}

/// <summary>
/// Write the contents of the strig builder
/// Write the contents of the string builder
/// </summary>
/// <param name="sb">string builder that contains the string to write</param>
/// <returns>CodeWriter</returns>
Expand Down
4 changes: 2 additions & 2 deletions src/typechat/Schema/JsonVocabAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Microsoft.TypeChat.Schema;

/// <summary>
/// Json objects contain string properties that can be assigned values from a known set of strings: vocabularies.
/// The JsonVocab atribute lets you specify these values as easily as you would in Typescript.
/// The JsonVocab attribute lets you specify these values as easily as you would in Typescript.
/// During deserialization, the custom JsonVocabConverter verifies that the string property only contains
/// values that belong to the vocabulary
///
Expand All @@ -26,7 +26,7 @@ public JsonVocabAttribute() { }
/// <summary>
/// Define a JsonVocab attribute
/// </summary>
/// <param name="entries">The entires in the vocabulary , each separated by a '|'</param>
/// <param name="entries">The entries in the vocabulary , each separated by a '|'</param>
/// <param name="propertyName">The json property name for which this is a vocabulary</param>
public JsonVocabAttribute(string entries, string? propertyName = null)
{
Expand Down
Loading