Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.4.0 #20

Merged
merged 3 commits into from Mar 20, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 14 additions & 4 deletions HttpGPT.uplugin
@@ -1,10 +1,10 @@
{
"FileVersion": 3,
"Version": 5,
"VersionName": "1.3.0",
"Version": 6,
"VersionName": "1.4.0",
"EngineVersion": "5.1.0",
"FriendlyName": "HttpGPT - ChatGPT via REST",
"Description": "HttpGPT is an Unreal Engine plugin that facilitates integration with Chat GPT through asynchronous REST requests, making it easy for developers to communicate with the chatbot.",
"FriendlyName": "HttpGPT - ChatGPT integrated in the Engine",
"Description": "HttpGPT is an Unreal Engine plugin that facilitates integration with Chat GPT through asynchronous REST requests, making it easy for developers to communicate with the chatbot. HttpGPT also includes a new Editor Tool to integrate Chat GPT directly in the Engine.",
"Category": "Messaging",
"CreatedBy": "Lucas Vilas-Boas",
"CreatedByURL": "https://github.com/lucoiso",
Expand All @@ -27,6 +27,16 @@
"IOS",
"Android"
]
},
{
"Name": "HttpGPTEditor",
"Type": "Editor",
"PlatformAllowList": [
"Win64",
"Mac",
"Linux"
],
"LoadingPhase": "Default"
}
]
}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@

![Banner1](https://user-images.githubusercontent.com/77353979/226219720-150abd31-487c-474f-ab14-576ff2efbdde.png)

HttpGPT is an Unreal Engine plugin that facilitates integration with Chat GPT through asynchronous REST requests, making it easy for developers to communicate with the chatbot.
HttpGPT is an Unreal Engine plugin that facilitates integration with Chat GPT through asynchronous REST requests, making it easy for developers to communicate with the chatbot. HttpGPT also includes a new Editor Tool to integrate Chat GPT directly in the Engine.

## Links
* [Documentation](https://github.com/lucoiso/UEHttpGPT/wiki)
Expand Down
70 changes: 70 additions & 0 deletions Source/HttpGPT/Private/HttpGPTHelper.cpp
Expand Up @@ -41,6 +41,36 @@ const FName UHttpGPTHelper::ModelToName(const EHttpGPTModel& Model)
return NAME_None;
}

const EHttpGPTModel UHttpGPTHelper::NameToModel(const FName Model)
{
if (Model.IsEqual("gpt-4", ENameCase::IgnoreCase))
{
return EHttpGPTModel::gpt4;
}
else if (Model.IsEqual("gpt-4-32k", ENameCase::IgnoreCase))
{
return EHttpGPTModel::gpt432k;
}
else if (Model.IsEqual("gpt-3.5-turbo", ENameCase::IgnoreCase))
{
return EHttpGPTModel::gpt35turbo;
}
else if (Model.IsEqual("text-davinci-003", ENameCase::IgnoreCase))
{
return EHttpGPTModel::textdavinci003;
}
else if (Model.IsEqual("text-davinci-002", ENameCase::IgnoreCase))
{
return EHttpGPTModel::textdavinci002;
}
else if (Model.IsEqual("code-davinci-002", ENameCase::IgnoreCase))
{
return EHttpGPTModel::codedavinci002;
}

return EHttpGPTModel::gpt35turbo;
}

const TArray<FName> UHttpGPTHelper::GetAvailableGPTModels()
{
TArray<FName> Output;
Expand All @@ -55,3 +85,43 @@ const TArray<FName> UHttpGPTHelper::GetAvailableGPTModels()

return Output;
}

const FName UHttpGPTHelper::GetEndpointForModel(const EHttpGPTModel& Model)
{
switch (Model)
{
case EHttpGPTModel::gpt4:
case EHttpGPTModel::gpt432k:
case EHttpGPTModel::gpt35turbo:
return "v1/chat/completions";

case EHttpGPTModel::textdavinci003:
case EHttpGPTModel::textdavinci002:
case EHttpGPTModel::codedavinci002:
return "v1/completions";

default: break;
}

return NAME_None;
}

const bool UHttpGPTHelper::ModelSupportsChat(const EHttpGPTModel& Model)
{
switch (Model)
{
case EHttpGPTModel::gpt4:
case EHttpGPTModel::gpt432k:
case EHttpGPTModel::gpt35turbo:
return true;

case EHttpGPTModel::textdavinci003:
case EHttpGPTModel::textdavinci002:
case EHttpGPTModel::codedavinci002:
return false;

default: break;
}

return false;
}