GithubHelp home page GithubHelp logo

financial_advisor_agent's Introduction

Stock Expert Agent with Function Calling

Introduction

This is a stock expert agent that can help you to make decisions on stock trading. It has abilities to access the stock data, analyze the stock data, news, and provide recommendation. It is built on OpenAI Assistant API.

Why need function calling?

Why need function calling Function calling allow user to use natural language to call task/function correctly. It also allows user to pass parameters to the function.

OpenAI Assistant API

OpenAI Assistant API is a powerful tool that can help you to build a conversational AI. OpenAI Assistant API Source: OPENAI - How Assistants work

OBJECT WHAT IT REPRESENTS
Assistant Purpose-built AI that uses OpenAI’s models and calls tools
Thread A conversation session between an Assistant and a user. Threads store Messages and automatically handle truncation to fit content into a model’s context.
Message A message created by an Assistant or a user. Messages can include text, images, and other files. Messages stored as a list on the Thread.
Run An invocation of an Assistant on a Thread. The Assistant uses its configuration and the Thread’s Messages to perform tasks by calling models and tools. As part of a Run, the Assistant appends Messages to the Thread.
Run Step A detailed list of steps the Assistant took as part of a Run. An Assistant can call tools or create Messages during its run. Examining Run Steps allows you to introspect how the Assistant is getting to its final results.

how assistant API run works

Assistant API Run Run is asynchrounous. So we need to wait for the run to complete before we can get the result. We can get the result when status is completed.

Create Assistant (No-code)

  1. Go to OpenAI. Login or create an account.
  2. Navigate to the Assistants tab.
  3. Click on + Create to start creating a new assistant. OpenAI Interface
  4. Fill in the details for the assistant. Name, prompt, function, code interpreter, and files. 4.1 for Function calling, we need to specify schema. e.g.
    {
      "name": "get_news",
      "description": "Get latest news on specified stock name or symbol. Return headline and links.",
      "parameters": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "description": "Symbol of stock or company name. Used as a query for stock data API calling"
          }
        },
        "required": ["ticker"]
      }
    }
  5. to use the assistant, grab assistant id from the settings.

FMP API

FMP API provides the stock data and news. Docs

gnews API

gnews API provides the news data. Docs

How to deploy app on streamlit

  1. create repository on github with requirements.txt
  2. go to https://www.streamlit.io/
  3. login and create New App
  4. connect to github
  5. select the repository
  6. make sure you specify the right file to run the app e.g. app.py
  7. deploy the app

Appendix:

financial_advisor_agent's People

Contributors

jackgurae avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.