FAST API
akasha 提供get_response, ask_self, ask_whole_file, get_summary的api server
啟動
akasha api (–port {port} –host {host} –workers {num_of_workers})
Example
import requests
import os
批量推理
如果你有大量不需要連貫的推理需求,可以使用akasha.helper.call_batch_model 來進行批量推理來提升速度。
call_batch_model
def call_batch_model(model: LLM, prompt: List[str],
system_prompt: Union[List[str], str] = "") -> List[str]:
import akasha
model_obj = akasha.helper.handle_model("openai:gpt-3.5-turbo", False, 0.0)
# this prompt ask LLM to response 'yes' or 'no' if the document segment is relevant to the user question or not.
ask_agent
如果你想詢問較複雜的問題,使用ask_agent,語言模型會將你的問題拆解來提供較好的回答。
example
ak = akasha.Doc_QA(
verbose=True,
chunk_size=500,
model="openai:gpt-3.5-turbo",
)
res = ak.ask_agent(
colinchu changed a year agoView mode Like Bookmark