-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Marco-Zechner/13-tool-calls
# 13 tool calls - 3 Commit-Merge ## 1 Refactored Project Sorted the Files in the Project Moved each used Class into their own File Redefined the IntegrationTests for ToolUsage Wrote Usage Tutorial in the IntegrationTest Added missing Models required for ToolCalls Added Attributes to define Tools Added Framework to Recognize and Call Methods as Tools Refactored the InstanceToolsManager ## 2 Cleaned up Implementation Test Renamed Attributes to consistent Pattern Refactored InstanceToolsManager and named the inherited Class InstanceToolsBase removed readonly modifier in GPTModel Complete Add/Remove Tool and ToolClass Extracted HelperMethods. (Better naming required!) **(disabled)** Added Experimental Implementation of Instance Management Tools ## 3 Finished static Tool Implementation Improved the static tool example in the Implementation Test even more. Changed some namespaces so the user must import less Added a Timestamp field to ChatResponse for later use in streaming Improved PropertyAccess enum Added possibility to disable tool-usage per completion Reworked ToolNaming pattern and removed Enum as a valid Tool Parameter Type for now Added additional Completion Methods to use for streaming later.
- Loading branch information
Showing
50 changed files
with
1,932 additions
and
504 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
OpenAI.ChatGPT.Net.IntegrationTests/Handlers/JsonDebugHandlers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace OpenAI.ChatGPT.Net.IntegrationTests.Handlers | ||
{ | ||
public class JsonDebugHandlers | ||
{ | ||
public static string PrintPayloadHandler(string payload) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.WriteLine("Payload:"); | ||
Console.WriteLine(payload); | ||
Console.ResetColor(); | ||
return payload; | ||
} | ||
|
||
public static string PrintResponseHandler(string response) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Yellow; | ||
Console.WriteLine("Response:"); | ||
Console.WriteLine(response); | ||
Console.ResetColor(); | ||
return response; | ||
} | ||
} | ||
} |
21 changes: 12 additions & 9 deletions
21
...IntegrationTests/Tools/InstanceToolCar.cs → ...grationTests/InstanceTools/CarInstance.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using OpenAI.ChatGPT.Net.Tools; | ||
|
||
namespace OpenAI.ChatGPT.Net.IntegrationTests.Tools | ||
{ | ||
/// <summary> | ||
/// Methods of a Class locked with [<see cref="GPT_Locked"/>] can't be used by GPT even if you attempt to add them. | ||
/// </summary> | ||
[GPT_Locked] | ||
internal class LockedClass | ||
{ | ||
public static void NonToolMethods1() { } | ||
|
||
public static void NonToolMethods2() { } | ||
|
||
public static void NonToolMethods3() { } | ||
} | ||
|
||
internal class AllLockedClass | ||
{ | ||
[GPT_Locked] | ||
public static void NonToolMethods1() { } | ||
|
||
[GPT_Locked] | ||
public static void NonToolMethods2() { } | ||
|
||
[GPT_Locked] | ||
public static void NonToolMethods3() { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
OpenAI.ChatGPT.Net.IntegrationTests/Tools/NonToolMethods.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace OpenAI.ChatGPT.Net.Tools | ||
{ | ||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | ||
public class GPT_Data(PropertyAccess propertyAccess = PropertyAccess.Both) : Attribute | ||
{ | ||
public PropertyAccess PropertyAccess { get; } = propertyAccess; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace OpenAI.ChatGPT.Net.Tools | ||
{ | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | ||
public class GPT_Description(string descriptionForAPI) : Attribute | ||
{ | ||
public string DescriptionForAPI { get; } = descriptionForAPI; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace OpenAI.ChatGPT.Net.Tools | ||
{ | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] | ||
public class GPT_Locked : Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace OpenAI.ChatGPT.Net.Tools | ||
{ | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
public class GPT_Parameters(params string[] descriptionsForAPI) : Attribute | ||
{ | ||
public string[] DescriptionsForAPI { get; } = descriptionsForAPI; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace OpenAI.ChatGPT.Net.Tools | ||
{ | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
public class GPT_Tool() : Attribute | ||
{ | ||
} | ||
} |
Oops, something went wrong.