-
Notifications
You must be signed in to change notification settings - Fork 215
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
feat(wren-ai-service): integrate dspy into wrenAI #805
Conversation
async def generate_sql(prompt: dict, generator: Any) -> dict: | ||
logger.debug(f"prompt: {orjson.dumps(prompt, option=orjson.OPT_INDENT_2).decode()}") | ||
return await generator.run(prompt=prompt.get("prompt")) | ||
async def generate_sql(prompt: dict, generator: Any, dspy_module: Any) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tedyyan could you help figure out if dspy_module supports async?
class SQLGeneration(BasicPipeline): | ||
def __init__( | ||
self, | ||
llm_provider: LLMProvider, | ||
engine: Engine, | ||
**kwargs, | ||
): | ||
self.dspy_module = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, could you explain to me what do these lines of code mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tedyyan thanks for your contribution. I think we can schedule a time to discuss this pr
…WrenAI into chore/ai-service/dspy_integrate
poetry lock —no-update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your contribution
Co-authored-by: Teddy Yan <[email protected]> Co-authored-by: Chih-Yu Yeh <[email protected]>
[wren-ai-service/eval/prompt_optimizer.py](https://github.com/Canner/WrenAI/blob/main/wren-ai-service/eval/README.md#eval-dataset-preparationif-using-spider-10-dataset)
======================= 1 =====================
================ Build the module =================
use eval.py and the spider2 v1 dataset to train and optimize a dspy module (https://github.com/taoyds/spider/tree/master/evaluation_examples/examples)
The prediction_eval_ask_9df57d69-250c-4a10-b6a5-6595509fed6b_2024_10_23_132136.toml is a predict dataset without dspy
output:
eval/optimized/AskGenerationV1_optimized_2024_10_21_181426.json
====================== 2 =======================
=================Prediction =================
DSPY_OPTIMAZED_MODEL
====================== 3 =======================
=============== Evaluate =========================
Notes:
wren-ai-service/eval/prompt_optimizer.py can be improved by incorporating additional training examples or use other modules in dspy
Thanks for @cyyeh guide and codes, most of the PR's code are borrowed from his branch
chore/ai-service/dspy