Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions financial-tools-chat/README.md
Original file line number Diff line number Diff line change
@@ -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).
23 changes: 23 additions & 0 deletions financial-tools-chat/earnings-prompt.txt
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion financial-tools-chat/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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": "<b>Welcome to HackerNews Listener: your insight tool for Hacker News discussions</b>\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:<ul>\n<li>Ask questions: Use the app to ask specific questions about the discussions happening within those topics using the Knowledge Graph chat tool. </li>\n<li>Receive insights: HackerNews Listener analyzes the discussions using Palmyra X 004 and provides you with summarized answers and insights based on real-time conversations. </li>\n</ul>", "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": "<b>Welcome to the Writer Hacker News Listener: Navigate and analyze Hacker News posts and comments.</b>\n\nWith Hacker News Listener you can:<ul>\n<li>Find news: Pull the latest N posts.</li>\n<li>Ask questions: Explore trending topics, discover recent company and product releases, open-source projects, or job listings.</li>\n<li>Generate a report: Automatically summarize the most popular topics in one click.</li>\n</ul>\nHow the Hacker News Listener works:<ul>\n<li>Data retrieval: The Hacker News API connects to Writer\u2019s graph-based database, known as a Knowledge Graph. This database is accessed dynamically by an LLM through the Writer RAG tool.</li>\n<li>Question answering: The LLM, Palmyra X 004 interprets user queries, calls the Writer RAG tool to retrieve relevant Hacker News posts, and generates responses.</li>\n<li>Report generation: Palmyra X 004 analyzes the N posts stored in the Writer Knowledge Graph and produces a pre-determined structured report highlighting key trends and insights.</li></ul>\nLearn how to <a href=\"https://writer.com/engineering/rag-tool/\" target=\"_blank\">build your own RAG app</a>.", "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}
Expand All @@ -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}}
2 changes: 1 addition & 1 deletion hacker-news-social-listener/.wf/metadata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"writer_version": "0.8.1"
"writer_version": "0.8.2"
}
4 changes: 3 additions & 1 deletion hacker-news-social-listener/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:


Expand Down
2 changes: 1 addition & 1 deletion hacker-news-social-listener/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down