mirror of
https://github.com/ianarawjo/ChainForge.git
synced 2025-03-14 08:16:37 +00:00
Fix bug with new OpenAI models
This commit is contained in:
parent
0b32792d07
commit
4ba0a9f998
@ -1,15 +1,15 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.8665fcca.css",
|
||||
"main.js": "/static/js/main.38f29425.js",
|
||||
"main.js": "/static/js/main.74fd3890.js",
|
||||
"static/js/787.4c72bb55.chunk.js": "/static/js/787.4c72bb55.chunk.js",
|
||||
"index.html": "/index.html",
|
||||
"main.8665fcca.css.map": "/static/css/main.8665fcca.css.map",
|
||||
"main.38f29425.js.map": "/static/js/main.38f29425.js.map",
|
||||
"main.74fd3890.js.map": "/static/js/main.74fd3890.js.map",
|
||||
"787.4c72bb55.chunk.js.map": "/static/js/787.4c72bb55.chunk.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.8665fcca.css",
|
||||
"static/js/main.38f29425.js"
|
||||
"static/js/main.74fd3890.js"
|
||||
]
|
||||
}
|
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><script async src="https://www.googletagmanager.com/gtag/js?id=G-RN3FDBLMCR"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-RN3FDBLMCR")</script><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="A visual programming environment for prompt engineering"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>ChainForge</title><script defer="defer" src="/static/js/main.38f29425.js"></script><link href="/static/css/main.8665fcca.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><script async src="https://www.googletagmanager.com/gtag/js?id=G-RN3FDBLMCR"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-RN3FDBLMCR")</script><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="A visual programming environment for prompt engineering"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>ChainForge</title><script defer="defer" src="/static/js/main.74fd3890.js"></script><link href="/static/css/main.8665fcca.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,6 +5,7 @@ export type LLM = string | NativeLLM;
|
||||
export enum NativeLLM {
|
||||
// OpenAI Chat
|
||||
OpenAI_ChatGPT = "gpt-3.5-turbo",
|
||||
OpenAI_ChatGPT_1106 = "gpt-3.5-turbo-1106",
|
||||
OpenAI_ChatGPT_16k = "gpt-3.5-turbo-16k",
|
||||
OpenAI_ChatGPT_16k_0613 = "gpt-3.5-turbo-16k-0613",
|
||||
OpenAI_ChatGPT_0301 = "gpt-3.5-turbo-0301",
|
||||
@ -12,6 +13,7 @@ export enum NativeLLM {
|
||||
OpenAI_GPT4 = "gpt-4",
|
||||
OpenAI_GPT4_0314 = "gpt-4-0314",
|
||||
OpenAI_GPT4_0613 = "gpt-4-0613",
|
||||
OpenAI_GPT4_1106_Prev = "gpt-4-1106-preview",
|
||||
OpenAI_GPT4_32k = "gpt-4-32k",
|
||||
OpenAI_GPT4_32k_0314 = "gpt-4-32k-0314",
|
||||
OpenAI_GPT4_32k_0613 = "gpt-4-32k-0613",
|
||||
@ -19,6 +21,7 @@ export enum NativeLLM {
|
||||
// OpenAI Text Completions
|
||||
OpenAI_Davinci003 = "text-davinci-003",
|
||||
OpenAI_Davinci002 = "text-davinci-002",
|
||||
OpenAI_ChatGPT_Instruct = "gpt-3.5-turbo-instruct",
|
||||
|
||||
// Azure OpenAI Endpoints
|
||||
Azure_OpenAI = "azure-openai",
|
||||
|
@ -190,7 +190,9 @@ export async function call_chatgpt(prompt: string, model: LLM, n: number = 1, te
|
||||
|
||||
// Get the correct function to call
|
||||
let openai_call: any;
|
||||
if (modelname.includes('davinci')) {
|
||||
if (modelname.includes('davinci') || modelname.includes('instruct')) {
|
||||
if ('response_format' in query)
|
||||
delete query.response_format;
|
||||
// Create call to text completions model
|
||||
openai_call = openai.createCompletion.bind(openai);
|
||||
query['prompt'] = prompt;
|
||||
@ -811,9 +813,10 @@ return response.map((r: string) => r.trim());
|
||||
*/
|
||||
export function extract_responses(response: Array<string | Dict> | Dict, llm: LLM | string): Array<string> {
|
||||
let llm_provider: LLMProvider = getProvider(llm as LLM);
|
||||
const llm_name = llm.toString().toLowerCase();
|
||||
switch (llm_provider) {
|
||||
case LLMProvider.OpenAI:
|
||||
if (llm.toString().toLowerCase().includes('davinci'))
|
||||
if (llm_name.includes('davinci') || llm_name.includes('instruct'))
|
||||
return _extract_openai_completion_responses(response);
|
||||
else
|
||||
return _extract_chatgpt_responses(response);
|
||||
|
Loading…
x
Reference in New Issue
Block a user