Skip to content

Commit

Permalink
feat(core): Support max output tokens parameter (#2218)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyinc authored Dec 18, 2024
1 parent b05febb commit 7f4b5e7
Show file tree
Hide file tree
Showing 121 changed files with 333 additions and 219 deletions.
1 change: 1 addition & 0 deletions dbgpt/app/openapi/api_v1/api_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ async def get_chat_instance(dialogue: ConversationVo = Body()) -> BaseChat:
"app_code": dialogue.app_code,
"ext_info": dialogue.ext_info,
"temperature": dialogue.temperature,
"max_new_tokens": dialogue.max_new_tokens,
}
chat: BaseChat = await blocking_func_to_async(
get_executor(),
Expand Down
2 changes: 2 additions & 0 deletions dbgpt/app/openapi/api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ async def get_chat_instance(dialogue: ChatCompletionRequestBody = Body()) -> Bas
"current_user_input": dialogue.messages,
"select_param": dialogue.chat_param,
"model_name": dialogue.model,
"temperature": dialogue.temperature,
"max_new_tokens": dialogue.max_new_tokens,
}
chat: BaseChat = await blocking_func_to_async(
get_executor(),
Expand Down
1 change: 1 addition & 0 deletions dbgpt/app/openapi/api_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ConversationVo(BaseModel):
app_code: Optional[str] = ""

temperature: Optional[float] = 0.5
max_new_tokens: Optional[int] = 2048
"""
chat scene select param
"""
Expand Down
4 changes: 1 addition & 3 deletions dbgpt/app/operators/rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ async def map(self, context: HOContextBody) -> List[Chunk]:
name="higher_order_knowledge_operator",
category=OperatorCategory.RAG,
description=_(
_(
"Knowledge Space Operator, retrieve your knowledge from knowledge space"
)
_("Knowledge Space Operator, retrieve your knowledge from knowledge space")
),
parameters=[
Parameter.build_from(
Expand Down
11 changes: 8 additions & 3 deletions dbgpt/app/scene/base_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,16 @@ async def _build_model_request(self) -> ModelRequest:
chat_mode=self.chat_mode.value(),
span_id=root_tracer.get_current_span_id(),
)
temperature = float(
self._chat_param.get("temperature", self.prompt_template.temperature)
)
max_new_tokens = int(
self._chat_param.get("max_new_tokens", self.prompt_template.max_new_tokens)
)
node = AppChatComposerOperator(
model=self.llm_model,
temperature=self._chat_param.get("temperature")
or float(self.prompt_template.temperature),
max_new_tokens=int(self.prompt_template.max_new_tokens),
temperature=temperature,
max_new_tokens=max_new_tokens,
prompt=self.prompt_template.prompt,
message_version=self._message_version,
echo=self.llm_echo,
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/app/static/web/404.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="icon" href="/favicon.ico"/><meta name="description" content="Revolutionizing Database Interactions with Private LLM Technology"/><meta property="og:description" content="eosphoros-ai"/><meta property="og:title" content="DB-GPT"/><link rel="preload" href="/_next/static/css/56abd552837c60f9.css" as="style"/><link rel="stylesheet" href="/_next/static/css/56abd552837c60f9.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-c84cdc13d41d4170.js" defer=""></script><script src="/_next/static/chunks/framework-8b06d32cbb857e0e.js" defer=""></script><script src="/_next/static/chunks/main-6c4c7f5b8c9b1320.js" defer=""></script><script src="/_next/static/chunks/pages/_app-7c76237d5662964a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8095ba9e1bf12f30.js" defer=""></script><script src="/_next/static/uxzFDWvtDY7kRGsQkNbam/_buildManifest.js" defer=""></script><script src="/_next/static/uxzFDWvtDY7kRGsQkNbam/_ssgManifest.js" defer=""></script><link rel="stylesheet" href="/_next/static/css/antd-output/antd.min.7d5365b5.css"/></head><body><div id="__next"><div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"uxzFDWvtDY7kRGsQkNbam","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="icon" href="/favicon.ico"/><meta name="description" content="Revolutionizing Database Interactions with Private LLM Technology"/><meta property="og:description" content="eosphoros-ai"/><meta property="og:title" content="DB-GPT"/><link rel="preload" href="/_next/static/css/56abd552837c60f9.css" as="style"/><link rel="stylesheet" href="/_next/static/css/56abd552837c60f9.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-be7003411ffbe393.js" defer=""></script><script src="/_next/static/chunks/framework-8b06d32cbb857e0e.js" defer=""></script><script src="/_next/static/chunks/main-6c4c7f5b8c9b1320.js" defer=""></script><script src="/_next/static/chunks/pages/_app-dcdb32527e2fdd0b.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8095ba9e1bf12f30.js" defer=""></script><script src="/_next/static/dw2LVfeIFz9EZTHA03IHs/_buildManifest.js" defer=""></script><script src="/_next/static/dw2LVfeIFz9EZTHA03IHs/_ssgManifest.js" defer=""></script><link rel="stylesheet" href="/_next/static/css/antd-output/antd.min.7d5365b5.css"/></head><body><div id="__next"><div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"dw2LVfeIFz9EZTHA03IHs","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
2 changes: 1 addition & 1 deletion dbgpt/app/static/web/404/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="icon" href="/favicon.ico"/><meta name="description" content="Revolutionizing Database Interactions with Private LLM Technology"/><meta property="og:description" content="eosphoros-ai"/><meta property="og:title" content="DB-GPT"/><link rel="preload" href="/_next/static/css/56abd552837c60f9.css" as="style"/><link rel="stylesheet" href="/_next/static/css/56abd552837c60f9.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-c84cdc13d41d4170.js" defer=""></script><script src="/_next/static/chunks/framework-8b06d32cbb857e0e.js" defer=""></script><script src="/_next/static/chunks/main-6c4c7f5b8c9b1320.js" defer=""></script><script src="/_next/static/chunks/pages/_app-7c76237d5662964a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8095ba9e1bf12f30.js" defer=""></script><script src="/_next/static/uxzFDWvtDY7kRGsQkNbam/_buildManifest.js" defer=""></script><script src="/_next/static/uxzFDWvtDY7kRGsQkNbam/_ssgManifest.js" defer=""></script><link rel="stylesheet" href="/_next/static/css/antd-output/antd.min.7d5365b5.css"/></head><body><div id="__next"><div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"uxzFDWvtDY7kRGsQkNbam","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="icon" href="/favicon.ico"/><meta name="description" content="Revolutionizing Database Interactions with Private LLM Technology"/><meta property="og:description" content="eosphoros-ai"/><meta property="og:title" content="DB-GPT"/><link rel="preload" href="/_next/static/css/56abd552837c60f9.css" as="style"/><link rel="stylesheet" href="/_next/static/css/56abd552837c60f9.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-be7003411ffbe393.js" defer=""></script><script src="/_next/static/chunks/framework-8b06d32cbb857e0e.js" defer=""></script><script src="/_next/static/chunks/main-6c4c7f5b8c9b1320.js" defer=""></script><script src="/_next/static/chunks/pages/_app-dcdb32527e2fdd0b.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8095ba9e1bf12f30.js" defer=""></script><script src="/_next/static/dw2LVfeIFz9EZTHA03IHs/_buildManifest.js" defer=""></script><script src="/_next/static/dw2LVfeIFz9EZTHA03IHs/_ssgManifest.js" defer=""></script><link rel="stylesheet" href="/_next/static/css/antd-output/antd.min.7d5365b5.css"/></head><body><div id="__next"><div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"dw2LVfeIFz9EZTHA03IHs","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
73 changes: 73 additions & 0 deletions dbgpt/app/static/web/_next/static/chunks/152-56fad3e011927332.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

73 changes: 0 additions & 73 deletions dbgpt/app/static/web/_next/static/chunks/5110-8a865913c5fa1501.js

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7f4b5e7

Please sign in to comment.