Show HN: GPTBanker – map/reduce over documents of any length with OpenAI

wrotescan.com

3 points by aicharades a year ago

Hi all! I created a app that can map/reduce over documents of an arbitrary length with OpenAI completions.

You can enter in your OpenAI key and try it out.

The backend is built with LangChain, which made it easy to manage the models, workflows (chains), and troubleshoot pipelines with buffer issues.

Learnings: - Tokens was the most helpful key for calls rather than characters or words. LangChain also just implemented a token splitter, which made it easier for me to adapt to documents of any type. - Davinci performed much better than Curie for summarizing long documents over multiple chunks - Oftentimes a map step was the only thing needed and the reduce/combine introduced more errors instead of improving context.

aicharades a year ago

Here are a few sample prompts I found worked well for the mapping step:

Writer: Prompt: You are the writer Frank Herbert. Write a summary of a section of Dune based on the following input. The summary must be no longer than 650 characters long

Banker : Prompt: You are an investment banker. Write a company description in the style of a CIM based on a summary of the following section of an SEC filing. Focus on the company's operations. Do not use first person.

Storyteller : Prompt: You are a writer. Write a new story based on the section of a larger story you've been given. Include the character Equity Private and any employees of her private equity firm. Try to identify who Equity Private could be at the end of your story.

aicharades a year ago

I was really interested in how this could summarize primary sources, so I ran it on Hillary Clinton's emails.

------------------------

A Storyteller Summarizes Hillary Clinton’s Emails

Input: Raw PDF of 2016 Democratic National Committee email leak

------------------------

Prompt: I want you to act as a storyteller. You will come up with entertaining stories that are engaging, imaginative and captivating for the audience based on the summary text provided. It can be fairy tales, educational stories or any other type of stories which has the potential to capture people's attention and imagination. You have been given a section of a large set of emails to summarize and come up with an entertaining story.

------------------------

Output: Once upon a time, there was a group of diplomats working hard to make the world a better place. They had been discussing how to gain leverage over the Pakistanis to move them to more aggressively pursue Al-Qaeda. After much deliberation, they decided to use a combination of incentives and coercive measures to try to get the Pakistanis to cooperate. They offered incentives such as increased control over how Kerry-Lugar money was used and increased support for counterinsurgency capabilities. They also used coercive measures such as targeting military leaders who gave support to Al-Qaeda and its allies, and attempting to reduce Pakistani anxieties about the Indian front. In the end, their efforts paid off and the Pakistanis began to cooperate more with their mission. The diplomats had succeeded in making the world a better place.

The story follows Hillary as she juggles her busy schedule, responding to requests from her colleagues and friends. She is always willing to help, and her dedication to her work is evident. Despite her busy schedule, she is still able to find time to help those around her. A powerful leader was tasked with finding out whether a senator supported the surge in Iraq and obtaining a copy of his recent speech about troops to Afghanistan. The leader reached out to her team for help, and they worked together to draft a memo outlining four strategic interests, three of which overlapped with the leader's goals. With the help of her team, the leader was able to obtain the information she needed and use it to make a positive impact.

President Obama was faced with the challenge of how to win the war in Afghanistan without causing too much destruction and civilian casualties. He decided to increase the size of the Afghan army and police force, and to pay them better wages so they could live comfortably. He also decided to send more US Special Forces and tens of thousands of troops to the region. Despite these efforts, the Taliban continued to gain strength and support from the Pashtun community. Obama realized that he needed to find a better solution. He decided to focus on carefully thought out measures such as providing better pay for the Afghan army and police, and using diplomacy to negotiate with the Taliban. In the end, Obama was able to find a peaceful solution that allowed the US to win the war without causing too much destruction.

A Prime Minister of a country had a fear of losing his sight due to a childhood rugby injury. He had his eyes checked and it was found that he had two minor tears in his retina. He visited the world-renowned Moorfields Hospital for further examinations and the doctors decided against any further operations. The Prime Minister was grateful to the doctors and staff of the NHS, especially Moorfields Hospital. Meanwhile, the US Secretary of State was in contact with the Foreign Minister of Honduras to discuss the situation in the country. She asked her staff to call the US Congressman Payne to update him on the situation. Through her diplomatic efforts, she was able to make a positive impact on the lives of many.

A small island nation called Haiti faced many challenges, but the people of Haiti were determined to build a stable, prosperous and democratic future. The United Nations appointed President Clinton as a special envoy to Haiti, and he appointed Dr. Paul Farmer as the Deputy U.N. Special Envoy. Dr. Farmer had dedicated his life to helping the people of Haiti for the past 20 years. Despite the efforts of the U.S., U.N. and other countries, Haiti still faced many challenges. To help the people of Haiti, the U.S. State Department took a closer look at the challenges and Secretary Clinton's chief of staff briefed Members on the initial findings. The U.S. hoped to better target and coordinate assistance, engage the Haitian Diaspora, and make assistance sustainable. To help the people of Haiti, the U.S. proposed granting temporary protected status to Haitians living in the U.S. and included Haiti in security initiatives such as the Merida Initiative. With the help of the U.S., U.N. and other countries, the people of Haiti could build a brighter future.

There was also a great conflict between two powerful nations, Morocco and Guinea, over a passport that had been taken away from a citizen of Guinea. The leaders of the United States and France stepped in to help and offered ideas to help the two nations come to a resolution, but the leaders of Morocco and Guinea were still unable to come to an agreement. The leaders of the United States and France then decided to meet in Paris to discuss the situation further and were able to broker a deal between Morocco and Guinea, returning the passport to its rightful owner.

There was also a man named Tom who was nominated for a prestigious position, but his nomination was held up due to a disagreement between two powerful forces. A brave negotiator was able to convince the two sides to lift the hold on Tom's nomination, allowing him to achieve his dream.