Skip to content

Commit

Permalink
Add Home API
Browse files Browse the repository at this point in the history
  • Loading branch information
bi1101 committed Jun 6, 2024
1 parent dc93d73 commit 54aa6de
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions class-gwiz-gf-openai.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ public function feed_settings_fields()
'label' => __('RunPod Mistral-7b-instruct v0.1', 'gravityforms-openai'),
'tooltip' => 'API Provider: https://POD_ID-80.proxy.runpod.net/v1/'
),
array(
'value' => 'http://api3.ieltsscience.fun/v1/',
'label' => __('Home API Llama-3-8b-instruct', 'gravityforms-openai'),
'tooltip' => 'API Provider: https://api3.ieltsscience.fun/v1/'
),
),
'default_value' => 'https://api2.ieltsscience.fun/v1/',
);
Expand Down Expand Up @@ -762,7 +767,7 @@ public function feed_settings_fields()
'name' => 'runpod_pod_id',
'label' => 'RunPod Pod ID',
'type' => 'text',
'tooltip' => 'Enter the RunPod Pod ID to use for Mistral 7b Instruct v0.1',
'tooltip' => 'Enter the RunPod Pod ID to use.',
'class' => 'small',
),
),
Expand All @@ -774,14 +779,14 @@ public function feed_settings_fields()
'name' => 'chat_completions_lora_adapter',
'label' => 'Lora Adapter',
'type' => 'text',
'tooltip' => 'Enter the Lora Adapter to use for Mistral 7b Instruct v0.1.',
'tooltip' => 'Enter the Lora Adapter to use.',
'class' => 'small',
),
array(
'name' => 'chat_completions_lora_adapter_HF',
'label' => 'Lora Adapter HF',
'type' => 'text',
'tooltip' => 'Enter the Huggingface Lora Adapter to use for Mistral 7b Instruct v0.1.',
'tooltip' => 'Enter the Huggingface Lora Adapter to use.',
'class' => 'small',
),
array(
Expand Down Expand Up @@ -1441,7 +1446,7 @@ public function process_endpoint_chat_completions($feed, $entry, $form)
if (strpos($api_base, 'predibase') !== false) {
$model = $feed["meta"]['chat_completions_lora_adapter'];
$message = $feed["meta"]["chat_completions_lorax_message"];
} elseif (strpos($api_base, 'runpod') !== false) {
} elseif (strpos($api_base, 'runpod') !== false || strpos($api_base, 'api3') !== false) {
$model = $feed["meta"]['chat_completions_lora_adapter_HF'];
$message = $feed["meta"]["chat_completions_lorax_message"];
} else {
Expand Down Expand Up @@ -2013,10 +2018,10 @@ public function get_merge_tag_replacement($form, $entry, $feed_id, $url_encode,
$api_base = rgar($feed['meta'], "api_base_$primary_identifier", 'https://api.openai.com/v1/');

if (strpos($api_base, 'predibase') !== false) {
// Get the model from feed metadata based on user's role or membership
// Get the model from feed metadata
$model = $feed["meta"]['chat_completions_lora_adapter'];
} elseif (strpos($api_base, 'runpod') !== false) {
// Get the model from feed metadata based on user's role or membership
} elseif (strpos($api_base, 'runpod') !== false || strpos($api_base, 'api3') !== false) {
// Get the model from feed metadata
$model = $feed["meta"]['chat_completions_lora_adapter_HF'];
} else {
// Get the model from feed metadata based on user's role or membership
Expand Down

0 comments on commit 54aa6de

Please sign in to comment.