Skip to content

Commit

Permalink
添加 OpenAIEndpoint 参数。单元测试已通过。
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySu committed Oct 1, 2023
1 parent 81f3426 commit 5c9a3a7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Samples/Senparc.AI.Samples.Consoles/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"OpenAIKeys": {
"ApiKey": "YourOpenAIKey", //TODO:加密
"Endpoint": "",
"OrgaizationId": "YourOpenAIOrgId"
},
"HunggingFaceKeys": {
Expand Down
3 changes: 3 additions & 0 deletions src/Senparc.AI.Tests/RegisterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public void GlobalRegisterTest()

Assert.IsNotNull(senparcAiSetting.OpenAIKeys);
Assert.IsNotNull(senparcAiSetting.OpenAIKeys.ApiKey);

Assert.AreEqual("<YourOpenAiEndpoint>", senparcAiSetting.OpenAIKeys.Endpoint);

}
}
}
1 change: 1 addition & 0 deletions src/Senparc.AI.Tests/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"OpenAIKeys": {
"ApiKey": "YourOpenAIKey", //TODO:加密
"Endpoint": "<YourOpenAiEndpoint>",
"OrgaizationId": "YourOpenAIOrgId"
},
"HuggingFaceKeys": {
Expand Down
1 change: 1 addition & 0 deletions src/Senparc.AI/Entities/Keys/OpenAIKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Senparc.AI
public class OpenAIKeys
{
public string ApiKey { get; set; }
public string Endpoint { get; set; }
public string OrgaizationId { get; set; }
}
}
4 changes: 4 additions & 0 deletions src/Senparc.AI/Entities/SenparcAiSettingBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public class SenparcAiSettingBase : ISenparcAiSetting

#endregion

#region OpenAI
public virtual string OpenAIEndpoint => OpenAIKeys.Endpoint;

#endregion

#region NeuChar

Expand Down
6 changes: 6 additions & 0 deletions src/Senparc.AI/Interfaces/ISenparcAiSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public interface ISenparcAiSetting

#endregion

#region OpenAI

string OpenAIEndpoint { get; }

#endregion

#region NeuChar

/// <summary>
Expand Down

1 comment on commit 5c9a3a7

@JeffreySu
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#19

Please # to comment.