diff --git a/financial-tools-chat/README.md b/financial-tools-chat/README.md index 25ac50e..cd661f4 100644 --- a/financial-tools-chat/README.md +++ b/financial-tools-chat/README.md @@ -1,3 +1,50 @@ -This app was created using Writer Framework. +# Financial Tools Chat -To learn more about it, visit https://dev.writer.com/framework +A conversational interface for financial research tools. This application was created using Writer Framework and uses the Palmyra Financial model. + +## Description + +Financial Tools Chat is an interactive chat application that helps users with various financial research tools. Users can interact with the application through a chat interface to research and analyze: +- Stock price data +- Income statements +- Earnings reports (Note: Earnings reports are stored locally in `earnings-data.json`. Feel free to swap this out with a call to an API that provides earnings data.) + +## Prerequisites +First, ensure you have Poetry installed. Then, in the project directory, install the dependencies by running: + +```sh +poetry install +``` + +### Sign up for Writer AI Studio +To build this application, you'll need to sign up for [Writer AI Studio](https://app.writer.com/aistudio/signup?utm_campaign=devrel) and create a new API Key. + +To pass your API key to the Writer Framework, you'll need to set an environment variable called `WRITER_API_KEY`: +```sh +export WRITER_API_KEY=your-api-key +``` + +You can also set the `WRITER_API_KEY` in the `.env` file. + +### Create a no-code text generation application +You'll also need to [create a no-code text generation application](https://dev.writer.com/no-code/building-a-text-generation-app) in Writer AI Studio and add the Palmyra Financial model to it to run the earnings call analysis. Add two fields to the application: `name` (for the symbol) and `data` (for the earnings report). You can use the `earnings-prompt.txt` file as a prompt for the earnings call analysis. + +## Edit and run the application +To make changes or edit the application, navigate to root folder and use the following command: + + +```sh +writer edit . +``` + +Once you're ready to run the application, execute: + +```sh +writer run . +``` + +To learn more, check out the [full documentation for Writer Framework](https://dev.writer.com/framework/introduction). + +## About Writer + +Writer is the full-stack generative AI platform for enterprises. Quickly and easily build and deploy generative AI apps with a suite of developer tools fully integrated with our platform of LLMs, graph-based RAG tools, AI guardrails, and more. Learn more at [writer.com](https://www.writer.com?utm_source=github&utm_medium=readme&utm_campaign=framework). diff --git a/financial-tools-chat/earnings-prompt.txt b/financial-tools-chat/earnings-prompt.txt new file mode 100644 index 0000000..5d6797f --- /dev/null +++ b/financial-tools-chat/earnings-prompt.txt @@ -0,0 +1,23 @@ +# CONTEXT # +You are an expert at analyzing quarterly earnings reports. You are creating financial analysis report based on earning statements of specific symbol, provided at data section. Furthermore, you are acting really carefully, review the data and provide insights, trends, and financial analysis. + +# INSTRUCTIONS # +Create an expertly written financial analysis. + +# DATA # +Symbol of earnings data: {name} +Earnings report: {data} + +# ADDITIONAL GUIDELINES # +- Say a few words about financial performance: How did the company perform financially this quarter? Were revenue, profits, margins, etc. up or down compared to prior periods? Did they meet, exceed, or fall short of expectations? +- Provide future outlook: What is the company's outlook for upcoming quarters? Are they optimistic or cautious? What are their projections for key metrics? +- Compose some strategic initiatives: Did the company discuss any major strategic initiatives, partnerships, new products, expansion plans or other projects? What is the rationale and potential impact? +- Outline significant changes: Were there any notable leadership changes, restructurings, pivots in strategy or other significant developments disclosed? +- Use some numbers from provided data in your analysis report. +- Remember to base your analysis and recommendation solely on the provided earnings report for {name}. If there is insufficient information to draw a conclusion, state this limitation in your response. + +# USER REQUEST SAMPLE # +Here is the user request sample: "What you can say about IBM doings based on their earnings report?" + +# RESPONSE FORMAT # +Highlight headers, topics, main metrics and ideas. Use .md markup to style your text. \ No newline at end of file diff --git a/financial-tools-chat/prompts.py b/financial-tools-chat/prompts.py index 7e65772..ae8413c 100644 --- a/financial-tools-chat/prompts.py +++ b/financial-tools-chat/prompts.py @@ -24,7 +24,7 @@ If there is insufficient information to draw a conclusion, state this limitation in your response. # USER REQUEST SAMPLE # -Here is the user request sample: "Tell me about tesla stock" +Here is the user request sample: "Tell me about Tesla stock" # RESPONSE FORMAT # Highlight headers, topics, main metrics and ideas. Use .md markup to style your text. diff --git a/hacker-news-social-listener/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl b/hacker-news-social-listener/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl index 7958494..3ff7c86 100644 --- a/hacker-news-social-listener/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl +++ b/hacker-news-social-listener/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl @@ -1,10 +1,10 @@ {"id": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "type": "page", "content": {"pageMode": "compact"}, "handlers": {}, "isCodeManaged": false, "parentId": "root", "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}} -{"id": "bebc5fe9-63a7-46a7-b0fa-62303555cfaf", "type": "header", "content": {"text": "HackerNews Listener"}, "handlers": {}, "isCodeManaged": false, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}} +{"id": "bebc5fe9-63a7-46a7-b0fa-62303555cfaf", "type": "header", "content": {"text": "Hacker News Listener"}, "handlers": {}, "isCodeManaged": false, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}} {"id": "m7luxumzscv65i09", "type": "tabs", "content": {}, "handlers": {}, "isCodeManaged": false, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "position": 1, "visible": {"binding": "", "expression": true, "reversed": false}} {"id": "lon4vs20gd3myh7e", "type": "tab", "content": {"name": "Setup"}, "handlers": {}, "isCodeManaged": false, "parentId": "m7luxumzscv65i09", "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}} {"id": "62r9auy895datfnp", "type": "message", "content": {"message": "@{message_setup}"}, "handlers": {}, "isCodeManaged": false, "parentId": "lon4vs20gd3myh7e", "position": 0, "visible": {"binding": "message_setup_vis", "expression": "custom", "reversed": false}} -{"id": "5myjrizpz5uxilif", "type": "text", "content": {"text": "Welcome to HackerNews Listener: your insight tool for Hacker News discussions\n\nHackerNews Listener is designed to help you navigate and analyze discussions from related HackerNews topics. This app allows you to get best N top and new stories and ask targeted questions to gain insights into most popular topics of HackerNews.\n\nHow HackerNews Listener works:", "useMarkdown": "yes"}, "handlers": {}, "isCodeManaged": false, "parentId": "lon4vs20gd3myh7e", "position": 1, "visible": {"binding": "", "expression": true, "reversed": false}} -{"id": "wcljpgx0f50y5kac", "type": "sliderinput", "binding": {"eventType": "wf-number-change", "stateRef": "fetch_limit"}, "content": {"label": "Pull the Last N Posts", "maxValue": "500", "minValue": "10", "stepSize": "10"}, "handlers": {}, "isCodeManaged": false, "parentId": "lon4vs20gd3myh7e", "position": 2, "visible": {"binding": "", "expression": true, "reversed": false}} +{"id": "5myjrizpz5uxilif", "type": "text", "content": {"text": "Welcome to the Writer Hacker News Listener: Navigate and analyze Hacker News posts and comments.\n\nWith Hacker News Listener you can:\nHow the Hacker News Listener works:\nLearn how to build your own RAG app.", "useMarkdown": "yes"}, "handlers": {}, "isCodeManaged": false, "parentId": "lon4vs20gd3myh7e", "position": 1, "visible": {"binding": "", "expression": true, "reversed": false}} +{"id": "wcljpgx0f50y5kac", "type": "sliderinput", "binding": {"eventType": "wf-number-change", "stateRef": "fetch_limit"}, "content": {"label": "Pull the last N posts", "maxValue": "500", "minValue": "10", "stepSize": "10"}, "handlers": {}, "isCodeManaged": false, "parentId": "lon4vs20gd3myh7e", "position": 2, "visible": {"binding": "", "expression": true, "reversed": false}} {"id": "zw8nru7f036fdubh", "type": "horizontalstack", "content": {}, "handlers": {}, "isCodeManaged": false, "parentId": "lon4vs20gd3myh7e", "position": 3} {"id": "tk9h8c6f6kf44x7z", "type": "switchinput", "binding": {"eventType": "wf-toggle", "stateRef": "allow_comments"}, "content": {"label": "Include comments"}, "handlers": {}, "isCodeManaged": false, "parentId": "zw8nru7f036fdubh", "position": 0} {"id": "cwgi42r2nxzja4gg", "type": "button", "content": {"text": "Fetch posts"}, "handlers": {"wf-click": "fetch_posts"}, "isCodeManaged": false, "parentId": "zw8nru7f036fdubh", "position": 1} @@ -13,14 +13,14 @@ {"id": "46q42e5z5jninm4o", "type": "dataframe", "content": {"dataframe": "@{posts}", "enableDownload": "yes", "enableSearch": "yes", "showIndex": "no", "useMarkdown": "yes", "wrapText": "yes"}, "handlers": {}, "isCodeManaged": false, "parentId": "yo212stq5so5c5au", "position": 1, "visible": {"binding": "", "expression": true, "reversed": false}} {"id": "2d3gfh1tavmi1iab", "type": "heading", "content": {"text": "Scraped comments"}, "handlers": {}, "isCodeManaged": false, "parentId": "yo212stq5so5c5au", "position": 2, "visible": {"binding": "allow_comments", "expression": "custom", "reversed": false}} {"id": "q0275uf0oldds8v8", "type": "dataframe", "content": {"dataframe": "@{comments}", "enableDownload": "yes", "enableSearch": "yes", "showIndex": "no", "useMarkdown": "yes"}, "handlers": {}, "isCodeManaged": false, "parentId": "yo212stq5so5c5au", "position": 3, "visible": {"binding": "allow_comments", "expression": "custom", "reversed": false}} -{"id": "8eghbz6jlckh3zmd", "type": "tab", "content": {"name": "Chat with KG"}, "handlers": {}, "isCodeManaged": false, "parentId": "m7luxumzscv65i09", "position": 2, "visible": {"binding": "", "expression": true, "reversed": false}} +{"id": "8eghbz6jlckh3zmd", "type": "tab", "content": {"name": "Chat with Hacker News"}, "handlers": {}, "isCodeManaged": false, "parentId": "m7luxumzscv65i09", "position": 2, "visible": {"binding": "", "expression": true, "reversed": false}} {"id": "rpi88dvxmlxr0qd9", "type": "columns", "content": {}, "handlers": {}, "isCodeManaged": false, "parentId": "8eghbz6jlckh3zmd", "position": 0} {"id": "rosw32keaejygiir", "type": "column", "content": {"width": "13"}, "handlers": {}, "isCodeManaged": false, "parentId": "rpi88dvxmlxr0qd9", "position": 0} {"id": "crm2bdbrjclid4k4", "type": "chatbot", "content": {"conversation": "@{conversation}", "useMarkdown": "yes"}, "handlers": {"wf-chatbot-message": "message_handler"}, "isCodeManaged": false, "parentId": "rosw32keaejygiir", "position": 0} {"id": "814lb9dktd2e1ye3", "type": "horizontalstack", "content": {"contentHAlign": "start"}, "handlers": {}, "isCodeManaged": false, "parentId": "rosw32keaejygiir", "position": 1} {"id": "t171dwz5muor2n9x", "type": "text", "content": {"alignment": "center", "text": "@{contributing_sources_button_text}", "useMarkdown": "yes"}, "handlers": {"wf-click": "contributing_sources_change_vis"}, "isCodeManaged": false, "parentId": "814lb9dktd2e1ye3", "position": 0} {"id": "contributed_sources", "type": "column", "content": {"cssClasses": "files-list", "title": "Contributing sources", "width": "7"}, "handlers": {}, "isCodeManaged": false, "parentId": "rpi88dvxmlxr0qd9", "position": 1, "visible": {"binding": "contributing_sources_vis", "expression": "custom", "reversed": false}} -{"id": "erkqharzgysk5s3n", "type": "tab", "content": {"name": "Prepared report"}, "handlers": {}, "isCodeManaged": false, "parentId": "m7luxumzscv65i09", "position": 3, "visible": {"binding": "", "expression": true, "reversed": false}} +{"id": "erkqharzgysk5s3n", "type": "tab", "content": {"name": "Generate trend report"}, "handlers": {}, "isCodeManaged": false, "parentId": "m7luxumzscv65i09", "position": 3, "visible": {"binding": "", "expression": true, "reversed": false}} {"id": "vzbrrx0dlp3skcn2", "type": "message", "content": {"message": "@{message_report}"}, "handlers": {}, "isCodeManaged": false, "parentId": "erkqharzgysk5s3n", "position": 0, "visible": {"binding": "message_report_vis", "expression": "custom", "reversed": false}} {"id": "osvuzxnivfs3qrut", "type": "text", "content": {"text": "@{prepared_report}", "useMarkdown": "yes"}, "handlers": {}, "isCodeManaged": false, "parentId": "erkqharzgysk5s3n", "position": 1} {"id": "w2hg99rv80b12tpt", "type": "button", "content": {"text": "Generate report"}, "handlers": {"wf-click": "run_report"}, "isCodeManaged": false, "parentId": "erkqharzgysk5s3n", "position": 2, "visible": {"binding": "", "expression": true, "reversed": false}} diff --git a/hacker-news-social-listener/.wf/metadata.json b/hacker-news-social-listener/.wf/metadata.json index 0874722..8813979 100644 --- a/hacker-news-social-listener/.wf/metadata.json +++ b/hacker-news-social-listener/.wf/metadata.json @@ -1,3 +1,3 @@ { - "writer_version": "0.8.1" + "writer_version": "0.8.2" } \ No newline at end of file diff --git a/hacker-news-social-listener/README.md b/hacker-news-social-listener/README.md index 0f7dde6..158502f 100644 --- a/hacker-news-social-listener/README.md +++ b/hacker-news-social-listener/README.md @@ -1,4 +1,4 @@ -# AI listener: Hacker News listening app +# Hacker News Listener This application is built using the Writer Framework and is designed to scrape the top posts and comments from Hacker News. It processes the data, uploads it to a Writer Knowledge Graph for further analysis, and generates AI-powered insights based on the content of the posts. ## Usage @@ -23,6 +23,8 @@ export WRITER_API_KEY=your-api-key export GRAPH_ID=your-graph-id ``` +You can also set the `WRITER_API_KEY` and `GRAPH_ID` in the `.env` file. + To make changes or edit the application, navigate to root folder and use the following command: diff --git a/hacker-news-social-listener/main.py b/hacker-news-social-listener/main.py index 4a90667..72980bb 100644 --- a/hacker-news-social-listener/main.py +++ b/hacker-news-social-listener/main.py @@ -312,7 +312,7 @@ def contributing_sources_change_vis(state: WriterState) -> None: "graph_name": "", "uploaded_file": None, "graph_id": None, - "prepared_report": "# **Data summary report**", + "prepared_report": "# **Trend report**", "contributing_sources_button_text": "View contributing sources ◂", "message_setup": "", "message_report": "",