-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #54 Add ChatGPT config and initialization support
Updated `FindLog4cplus.cmake` to include additional search paths. Modified `CMakeLists.txt` to include new ChatGPT headers and copy `ChatGPTIPAProvider.json` to the config directory. Added new JSON config file `ChatGPTIPAProvider.json` for ChatGPT API settings. Added `ChatGPTConfiguration.h` for parsing JSON config. Updated `ChatGPTIPAProvider` class to load config values and use them in `processInput`. Updated `IPAProvider` to include a pure virtual `initialize` method. Modified `ProviderRegistry` to call `initialize` on IPA providers when added to the registry.
- Loading branch information
Showing
10 changed files
with
103 additions
and
14 deletions.
There are no files selected for viewing
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
5 changes: 5 additions & 0 deletions
5
source/w3cipa/w3cipachatgptipaprovider/ChatGPTIPAProvider.json
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,5 @@ | ||
{ | ||
"endpoint": "https://api.openai.com/v1/chat/completions", | ||
"key": "OPENAI-DEVELOPER-KEY", | ||
"systemMessage": "You are a standards maniac." | ||
} |
46 changes: 46 additions & 0 deletions
46
...er/include/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTConfiguration.h
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,46 @@ | ||
/* | ||
* IPA Reference Implementation: https://github.com/w3c/voiceinteraction | ||
* | ||
* Copyright (C) 2024 World Wide Web Consortium. All Rights Reserved. | ||
* | ||
* This work is distributed under the W3C Software and Document License [1] | ||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | ||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* [1] https://www.w3.org/Consortium/Legal/copyright-software | ||
*/ | ||
|
||
#ifndef CHATGPTCONFIGURATION_H | ||
#define CHATGPTCONFIGURATION_H | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
namespace w3c { | ||
namespace voiceinteraction { | ||
namespace ipa { | ||
namespace reference { | ||
namespace external { | ||
namespace ipa { | ||
namespace chatgpt { | ||
|
||
struct ChatGPTConfiguration { | ||
std::string endpoint; | ||
std::string key; | ||
std::string systemMessage; | ||
}; | ||
|
||
void from_json(const nlohmann::json& j, ChatGPTConfiguration& config) { | ||
j.at("endpoint").get_to(config.endpoint); | ||
j.at("key").get_to(config.key); | ||
j.at("systemMessage").get_to(config.systemMessage); | ||
} | ||
|
||
} // chatgpt | ||
} // ipa | ||
} // external | ||
} // namespace reference | ||
} // ipa | ||
} // voiceinteraction | ||
} // w3c | ||
|
||
#endif // CHATGPTCONFIGURATION_H |
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
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