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

Models superagi #936

Merged
merged 76 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
46ae580
adding llama2 changes using replicate
Jul 19, 2023
4dbe326
Adding misssing llm file
Jul 19, 2023
18da502
Update llm_model_factory.py
Jul 20, 2023
fd48dc7
Update token_counter.py
Jul 20, 2023
83a5dc1
adding replicate token in the config_example
Jul 21, 2023
c3b2a36
Update replicate.py
Jul 25, 2023
1ccd2cd
First Commit for Models
jedan2506 Aug 1, 2023
642b4b7
Second Commit for Models
jedan2506 Aug 1, 2023
43ecd31
Third Commit for Models
jedan2506 Aug 1, 2023
09f9cc7
Updated
jedan2506 Aug 1, 2023
5d75e13
Replicate Branch Merged
jedan2506 Aug 2, 2023
445c497
Updates
jedan2506 Aug 2, 2023
3da3d30
Merge branch 'dev' of github.com:TransformerOptimus/SuperAGI into mod…
jedan2506 Aug 2, 2023
f71338a
Updates
jedan2506 Aug 2, 2023
14edd62
Updates
jedan2506 Aug 2, 2023
f691411
Updates
jedan2506 Aug 3, 2023
3bbdc31
updates
jedan2506 Aug 3, 2023
f95f656
updates
jedan2506 Aug 3, 2023
d5f9411
updates
jedan2506 Aug 3, 2023
fadf8b1
Updates
jedan2506 Aug 4, 2023
57c3853
Updates
jedan2506 Aug 4, 2023
40f2d76
Updates
jedan2506 Aug 4, 2023
c8d42a7
Updates
jedan2506 Aug 4, 2023
91136ad
Updates
jedan2506 Aug 7, 2023
fcbfd17
Updates
jedan2506 Aug 7, 2023
8ff83b0
Updates
jedan2506 Aug 7, 2023
78ff836
Updates
jedan2506 Aug 7, 2023
fa4b38c
Updates
jedan2506 Aug 7, 2023
43bdd44
Updates
jedan2506 Aug 7, 2023
8bd95e6
Updates
jedan2506 Aug 7, 2023
ad9bc21
Updates
jedan2506 Aug 8, 2023
f5f2998
Updates
jedan2506 Aug 8, 2023
854e88c
Updates
jedan2506 Aug 9, 2023
52cb4aa
Updates
jedan2506 Aug 9, 2023
ec7c271
Updates
jedan2506 Aug 9, 2023
94d5977
Bug Fixes
jedan2506 Aug 10, 2023
f314325
Updates
jedan2506 Aug 10, 2023
955d648
Updates
jedan2506 Aug 10, 2023
adcf3a5
Updates
jedan2506 Aug 11, 2023
775fad7
Updates
jedan2506 Aug 13, 2023
ba7c9c6
Updates
jedan2506 Aug 16, 2023
9dbe3a3
Updates
jedan2506 Aug 16, 2023
27a2147
Updates
jedan2506 Aug 16, 2023
21e601b
Updates
jedan2506 Aug 17, 2023
02475a7
Updates
jedan2506 Aug 17, 2023
ab7ffe2
Updates
jedan2506 Aug 17, 2023
b712620
Updates
jedan2506 Aug 17, 2023
2601682
Updates
jedan2506 Aug 17, 2023
22e5c32
Updates
jedan2506 Aug 18, 2023
b9bafb0
Updates
jedan2506 Aug 18, 2023
5fc3c42
Updates
jedan2506 Aug 18, 2023
e01ccfe
Updates
jedan2506 Aug 18, 2023
3805f99
Updates
jedan2506 Aug 18, 2023
6729c11
Updates
jedan2506 Aug 18, 2023
3ac9ffa
Updates
jedan2506 Aug 18, 2023
0ec2709
Updates
jedan2506 Aug 18, 2023
12e904e
Updates
jedan2506 Aug 21, 2023
6e4efdd
Updates
jedan2506 Aug 21, 2023
3884f0a
Updates
jedan2506 Aug 21, 2023
87160ac
Updates
jedan2506 Aug 21, 2023
5ce47ce
Updates
jedan2506 Aug 21, 2023
05b14d9
Updates
jedan2506 Aug 22, 2023
edb27cd
Updates
jedan2506 Aug 22, 2023
db17d1b
Updates
jedan2506 Aug 22, 2023
4ff94f9
Updates
jedan2506 Aug 22, 2023
c0d3f44
Updates
jedan2506 Aug 22, 2023
9593ce9
Updates
jedan2506 Aug 22, 2023
91fd6a8
Updates
jedan2506 Aug 22, 2023
de30cb9
Updates
jedan2506 Aug 23, 2023
16671b0
Updates
jedan2506 Aug 23, 2023
83f37d1
Updates
jedan2506 Aug 23, 2023
c100b21
Updates
jedan2506 Aug 23, 2023
619c2fa
Updates
jedan2506 Aug 23, 2023
bdb7f85
Updates
jedan2506 Aug 23, 2023
fe63ddc
Updates
jedan2506 Aug 23, 2023
560870e
Updates
jedan2506 Aug 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ PINECONE_ENVIRONMENT: YOUR_PINECONE_ENVIRONMENT

OPENAI_API_KEY: YOUR_OPEN_API_KEY
PALM_API_KEY: YOUR_PALM_API_KEY
REPLICATE_API_TOKEN: YOUR_REPLICATE_API_TOKEN
HUGGING_API_TOKEN: YOUR_HUGGING_FACE_API_TOKEN

# For locally hosted LLMs comment out the next line and uncomment the one after
# to configure a local llm point your browser to 127.0.0.1:7860 and click on the model tab in text generation web ui.
Expand Down
2 changes: 1 addition & 1 deletion gui/pages/Content/APM/ApmDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function ApmDashboard() {
const fetchData = async () => {
try {
const [metricsResponse, agentsResponse, activeRunsResponse, toolsUsageResponse] = await Promise.all([getMetrics(), getAllAgents(), getActiveRuns(), getToolsUsage()]);
const models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-32k', 'google-palm-bison-001'];
const models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-32k', 'google-palm-bison-001', 'replicate-llama13b-v2-chat'];

assignDefaultDataPerModel(metricsResponse.data.agent_details.model_metrics, models);
assignDefaultDataPerModel(metricsResponse.data.tokens_details.model_metrics, models);
Expand Down
43 changes: 30 additions & 13 deletions gui/pages/Content/Agents/AgentCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getOrganisationConfig,
getLlmModels,
updateExecution,
uploadFile, getAgentWorkflows
uploadFile, getAgentWorkflows, fetchModels
} from "@/pages/api/DashboardService";
import {
formatBytes,
Expand Down Expand Up @@ -51,6 +51,7 @@ export default function AgentCreate({
const [searchValue, setSearchValue] = useState('');
const [showButton, setShowButton] = useState(false);
const [showPlaceholder, setShowPlaceholder] = useState(true);
const [modelsArray, setModelsArray] = useState([]);

const constraintsArray = [
"If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.",
Expand All @@ -63,8 +64,8 @@ export default function AgentCreate({
const [goals, setGoals] = useState(['Describe the agent goals here']);
const [instructions, setInstructions] = useState(['']);

const [modelsArray, setModelsArray] = useState([]);
const [model, setModel] = useState('');
const models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-32k', 'google-palm-bison-001', 'replicate-llama13b-v2-chat']
const [model, setModel] = useState(models[1]);
const modelRef = useRef(null);
const [modelDropdown, setModelDropdown] = useState(false);

Expand Down Expand Up @@ -145,16 +146,17 @@ export default function AgentCreate({
}, [toolNames]);

useEffect(() => {
getLlmModels()
fetchModels()
.then((response) => {
const models = response.data || [];
const models = response.data.map(model => model.name) || [];
const selected_model = localStorage.getItem("agent_model_" + String(internalId)) || '';
setModelsArray(models);
if (models.length > 0 && !selected_model) {
setLocalStorageValue("agent_model_" + String(internalId), models[0], setModel);
} else {
setModel(selected_model);
}
console.log(response)
})
.catch((error) => {
console.error('Error fetching models:', error);
Expand Down Expand Up @@ -314,7 +316,7 @@ export default function AgentCreate({

const handleModelSelect = (index) => {
setLocalStorageValue("agent_model_" + String(internalId), modelsArray[index], setModel);
if (modelsArray[index] === "google-palm-bison-001") {
if (modelsArray[index] === "google-palm-bison-001" || modelsArray[index] === "replicate-llama13b-v2-chat") {
setAgentType("Fixed Task Queue")
}
setModelDropdown(false);
Expand Down Expand Up @@ -861,13 +863,28 @@ export default function AgentCreate({
alt="expand-icon"/>
</div>
<div>
{modelDropdown && <div className="custom_select_options" ref={modelRef} style={{width: '100%'}}>
{modelsArray?.map((model, index) => (
<div key={index} className="custom_select_option" onClick={() => handleModelSelect(index)}
style={{padding: '12px 14px', maxWidth: '100%'}}>
{model}
</div>))}
</div>}
{modelDropdown && (
<div className="custom_select_options" ref={modelRef} style={{width: '100%', maxHeight: '300px'}}>
<div className="model_options">
{modelsArray?.map((model, index) => (
<div key={index} className="custom_select_option" onClick={() => handleModelSelect(index)}
style={{padding: '12px 14px', maxWidth: '100%'}}>
{model}
</div>
))}
</div>
<div className="vertical_containers sticky_option">
<div onClick={() => openNewTab(-4, "Marketplace", "Marketplace", false)} className="custom_select_option horizontal_container mxw_100 padding_12_14 gap_6 bt_white">
<Image width={16} height={16} src="/images/marketplace_logo.png" alt="marketplace_logo" />
<span>Browse models from marketplace</span>
</div>
<div onClick={() => openNewTab(-5, "new model", "Add_Model", false)} className="custom_select_option horizontal_container mxw_100 padding_12_14 gap_6 bt_white">
<Image width={16} height={16} src="/images/plus.png" alt="plus_image" />
<span>Add new custom model</span>
</div>
</div>
</div>
)}
</div>
</div>
</div>
Expand Down
50 changes: 20 additions & 30 deletions gui/pages/Content/Marketplace/Market.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import styles from './Market.module.css';
import MarketKnowledge from './MarketKnowledge';
import MarketAgent from './MarketAgent';
import MarketTools from './MarketTools';
import MarketModels from '../Models/MarketModels';
import ToolkitTemplate from './ToolkitTemplate';
import ModelTemplate from "../Models/ModelTemplate";
import {EventBus} from "@/utils/eventBus";
import AgentTemplate from "./AgentTemplate";
import KnowledgeTemplate from "./KnowledgeTemplate";
Expand Down Expand Up @@ -64,48 +66,36 @@ export default function Market({env}) {
<div style={{width: '100%', display: 'flex', flexDirection: 'column'}}>
<div className={styles.detail_top}>
<div style={{display: 'flex', overflowX: 'scroll', marginLeft: '8px'}}>
<div>
<button onClick={() => switchTab('market_tools')} className={styles.tab_button}
style={activeTab === 'market_tools' ? {
background: '#454254',
paddingRight: '15px'
} : {background: 'transparent', paddingRight: '15px'}}>
<Image style={{marginTop: '-1px'}} width={14} height={14} src="/images/tools_light.svg"
alt="tools-icon"/>&nbsp;Tools
</button>
</div>
<div>
<button onClick={() => switchTab('market_knowledge')} className={styles.tab_button}
style={activeTab === 'market_knowledge' ? {
background: '#454254',
paddingRight: '15px'
} : {background: 'transparent', paddingRight: '15px'}}>
<Image style={{marginTop: '-1px'}} width={14} height={14} src="/images/knowledge.svg"
alt="knowledge-icon"/>&nbsp;Knowledge
</button>
</div>
<div>
<button onClick={() => switchTab('market_agents')} className={styles.tab_button}
style={activeTab === 'market_agents' ? {
background: '#454254',
paddingRight: '15px'
} : {background: 'transparent', paddingRight: '15px'}}>
<Image style={{marginTop: '-1px'}} width={14} height={14} src="/images/agents_light.svg"
alt="agent-template-icon"/>&nbsp;Agent Templates
</button>
</div>
<button onClick={() => switchTab('market_tools')} className={activeTab === 'market_tools' ? 'tab_button_selected' : 'tab_button'}>
<Image width={14} height={14} src="/images/tools_light.svg" alt="tools-icon"/>
<span>Tools</span>
</button>
<button onClick={() => switchTab('market_knowledge')} className={activeTab === 'market_knowledge' ? 'tab_button_selected' : 'tab_button'}>
<Image width={14} height={14} src="/images/knowledge.svg" alt="knowledge-icon"/>
<span>Knowledge</span>
</button>
<button onClick={() => switchTab('market_agents')} className={activeTab === 'market_agents' ? 'tab_button_selected' : 'tab_button'}>
<Image width={14} height={14} src="/images/agents_light.svg" alt="agent-template-icon"/>
<span>Agent Templates</span>
</button>
<button onClick={() => switchTab('market_models')} className={activeTab === 'market_models' ? 'tab_button_selected' : 'tab_button'}>
<Image width={14} height={14} src="/images/models.svg" alt="model-template-icon"/>
<span>Models</span>
</button>
</div>
</div>
<div>
{activeTab === 'market_tools' && <MarketTools/>}
{activeTab === 'market_knowledge' && <MarketKnowledge/>}
{activeTab === 'market_agents' && <MarketAgent/>}
{activeTab === 'market_models' && <MarketModels/>}
</div>
</div>
</div> : <div style={{padding: '0 3px'}}>
{detailType === 'agent_template' && <AgentTemplate env={env} template={templateData}/>}
{detailType === 'knowledge_template' && <KnowledgeTemplate env={env} template={templateData}/>}
{detailType === 'tool_template' && <ToolkitTemplate env={env} template={templateData}/>}
{detailType === 'model_template' && <ModelTemplate env={env} template={templateData} />}
</div>}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion gui/pages/Content/Marketplace/Market.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
gap: 0.3vw;
gap: 6px;
}

.agent_resources {
Expand Down
16 changes: 16 additions & 0 deletions gui/pages/Content/Models/AddModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, {useEffect, useState} from "react";
import ModelForm from "./ModelForm";

export default function AddModel(){
return(
<div id="add_model">
<div className="row">
<div className="col-3" />
<div className="col-6 col-6-scrollable">
<ModelForm />
</div>
<div className="col-3" />
</div>
</div>
)
}
103 changes: 103 additions & 0 deletions gui/pages/Content/Models/AddModelMarketPlace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import React, {useState, useEffect} from "react";
import Image from "next/image";
import {openNewTab, modelIcon} from "@/utils/utils";
import {fetchApiKey, storeModel} from "@/pages/api/DashboardService";
import {toast} from "react-toastify";

export default function AddModelMarketPlace(template){
const [modelTokenLimit, setModelTokenLimit] = useState(4096);
const [modelVersion, setModelVersion] = useState('');
const [modelEndpoint, setModelEndpoint] = useState('');
const [tokenError, setTokenError] = useState(false);
const [templateData, setTemplateData] = useState(template.template);
const [isLoading, setIsLoading] = useState(false);

useEffect(()=>{
console.log(templateData)
jedan2506 marked this conversation as resolved.
Show resolved Hide resolved
checkModelProvider().then().catch();
},[])

const checkModelProvider = async () => {
const response = await fetchApiKey(templateData.source_name);
if(response && response.data && response.data[0].api_key === '') {
setTokenError(true)
return true
}
else {
setTokenError(false)
return false
}
}

const storeModelDetails = () => {
storeModel(templateData.model_name, templateData.description, modelEndpoint, templateData.model_provider_id, modelTokenLimit, "Marketplace", modelVersion).then((response) =>{
setIsLoading(false)
if (response.data.error) {
toast.error(response.data.error,{autoClose: 1800});
} else if (response.data.success) {
toast.success(response.data.success,{autoClose: 1800});
}
}).catch((error) => {
console.log("SORRY, There was an error storing the model details" + error);
setIsLoading(false)
});
}

return(
<div id="add_model_marketplace" className="row text_12 color_gray">
<div className="col-3" />
<div className="col-6 col-6-scrollable">
<div className="vertical_containers">
<span className="text_16 color_white">Add Model</span>

<div className="vertical_containers tag_container mt_24">
<span className="text_14 color_white">{templateData.model_name}</span>
<div className="horizontal_container mt_8">
<span>By {templateData.source_name}&nbsp;·&nbsp;</span>
<Image width={18} height={18} src={modelIcon(templateData.source_name)} alt="logo-icon" />
<span className="ml_4">{templateData.source_name}</span>
</div>
</div>
{templateData.source_name === 'Hugging Face' && <div className="vertical_containers">
<span className="mt_24">{templateData.source_name} Model Endpoint</span>
<input className="input_medium mt_8" type="text" placeholder="Enter Model Endpoint URL"
onChange={(event) => setModelEndpoint(event.target.value)}/>
</div>}

{templateData.source_name === 'Replicate' && <div className="vertical_containers">
<span className="mt_24">{templateData.source_name} Version</span>
<input className="input_medium mt_8" type="text" placeholder="Enter Model Version"
onChange={(event) => setModelVersion(event.target.value)}/>
</div>}

<span className="mt_24">Token Limit</span>
<input className="input_medium mt_8" type="number" placeholder="Enter the Token Limit" value={modelTokenLimit}
onChange={(event) => setModelTokenLimit(+event.target.value)} />

{tokenError && <div className="horizontal_container align_start error_box mt_24 gap_6">
<Image width={16} height={16} src="/images/icon_error.svg" alt="error-icon" />
<div className="vertical_containers">
<span className="text_12 color_white lh_16">The <b>{templateData.source_name}</b> auth token is not added to your settings. In order to start using the model, you need to add the auth token to your settings. You can find the auth token in the <b>{templateData.source_name}</b> dashboard. </span>
<div className="horizontal_container mt_16">
<button className="primary_button_small" onClick={() => openNewTab(-3, "Settings", "Settings", false)}>Add auth token</button>
<button className="secondary_button_small ml_8">Get auth token</button>
</div>
</div>
</div>}

<div className="horizontal_container align_start info_box mt_24 gap_6">
<Image width={16} height={16} src="/images/icon_info.svg" alt="error-icon" />
<div className="vertical_containers">
<span className="text_12 color_white lh_16">In order to get the endpoint for this model, you will need to deploy it on your Replicate dashboard. Once you have deployed your model on Hugging Face, you will be able to access the endpoint through the Hugging Face dashboard. The endpoint is a URL that you can use to send requests to your model.</span>
<button className="secondary_button_small w_fit_content mt_16" onClick={() => openNewTab(-3, "Settings", "Settings", false)}>Deploy</button>
</div>
</div>

<button className="primary_button w_fit_content align_self_end mt_24" disabled={tokenError}
onClick={() => storeModelDetails()}>Install</button>
</div>
</div>
<div className="col-3" />
</div>
)
}
Loading