我们可能习惯了将所有的业务逻辑丢到 service
里面去实现,似乎 service
是个万能的东西,这样造成的结果是,我们会丢失很多业务上的语义,丢失业务场景,
带来最大的麻烦是,后续维护的人理解起来会非常费劲,需要通过人脑将那些割裂的信息重新组织起来,这是一个非常费劲的过程,往往会造成一些理解上的偏差。
当然,一些简单的 CURD 并不在本文的讨论范围之内。
但是问题还是存在的,我们似乎缺少了一个地方,这个地方作为承载所有批量操作
PriceSku 的地方。当然放 service
也能跑,又不是不能用,只是最终结果是 service
越来越膨胀,承载的职责越来越多。 在这种情况下,我们可以考虑定义一个
PriceSkuCollection
类,在里面做那些批量操作,比如下面这样:
Given a raw text input to a language model select the model prompt best suited for the input. You will be given the names of the available prompts and a description of what the prompt is best suited for. You may also revise the original input if you think that revising it will ultimately lead to a better response from the language model.
<< FORMATTING >> Return a markdown code snippet with a JSON object formatted to look like: ```json { "destination": string \ name of the prompt to use or "DEFAULT" "next_inputs": string \ a potentially modified version of the original input } ```
REMEMBER: "destination" MUST be one of the candidate prompt names specified below OR it can be "DEFAULT" if the input is not well suited for any of the candidate prompts. REMEMBER: "next_inputs" can just be the original input if you don't think any modifications are needed.
from langchain.chains.router.llm_router import LLMRouterChain, RouterOutputParser from langchain.chains.router.multi_prompt_prompt import MULTI_PROMPT_ROUTER_TEMPLATE
Given a raw text input to a language model select the model prompt best suited for the input. You will be given the names of the available prompts and a description of what the prompt is best suited for. You may also revise the original input if you think that revising it will ultimately lead to a better response from the language model.
<< FORMATTING >> Return a markdown code snippet with a JSON object formatted to look like: ```json { "destination": string \ name of the prompt to use or "DEFAULT" "next_inputs": string \ a potentially modified version of the original input } ```
REMEMBER: "destination" MUST be one of the candidate prompt names specified below OR it can be "DEFAULT" if the input is not well suited for any of the candidate prompts. REMEMBER: "next_inputs" can just be the original input if you don't think any modifications are needed.