{"id":25435376,"url":"https://github.com/shubhammandowara/agents-from-scratch","last_synced_at":"2026-02-19T06:32:05.348Z","repository":{"id":272291244,"uuid":"901679233","full_name":"ShubhamMandowara/agents-from-scratch","owner":"ShubhamMandowara","description":"Unlock the power of AI by building intelligent agents from scratch! This repository provides a step-by-step guide to creating custom agents that can reason, act, and solve real-world problems","archived":false,"fork":false,"pushed_at":"2025-01-20T10:10:18.000Z","size":479,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-18T11:01:56.996Z","etag":null,"topics":["agents","ai-agent","ai-agents","ai-agents-framework","artificial-intelligence","automation","langchain","langchain-python","machinelearning","ollama","reasoning-agent","stock-agent","stock-market","yfinance"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShubhamMandowara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-11T05:39:59.000Z","updated_at":"2025-06-14T18:43:44.000Z","dependencies_parsed_at":"2025-05-15T00:47:47.303Z","dependency_job_id":null,"html_url":"https://github.com/ShubhamMandowara/agents-from-scratch","commit_stats":null,"previous_names":["shubhammandowara/agent-from-scratch","shubhammandowara/agents-from-scratch"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ShubhamMandowara/agents-from-scratch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamMandowara%2Fagents-from-scratch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamMandowara%2Fagents-from-scratch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamMandowara%2Fagents-from-scratch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamMandowara%2Fagents-from-scratch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShubhamMandowara","download_url":"https://codeload.github.com/ShubhamMandowara/agents-from-scratch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamMandowara%2Fagents-from-scratch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29604790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T05:11:50.834Z","status":"ssl_error","status_checked_at":"2026-02-19T05:11:38.921Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agents","ai-agent","ai-agents","ai-agents-framework","artificial-intelligence","automation","langchain","langchain-python","machinelearning","ollama","reasoning-agent","stock-agent","stock-market","yfinance"],"created_at":"2025-02-17T07:29:50.154Z","updated_at":"2026-02-19T06:32:05.330Z","avatar_url":"https://github.com/ShubhamMandowara.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## AI Stock Data Retriever\n\n### Overview\nThe **AI Stock Data Retriever** is a Streamlit application that integrates with the `llama3.2:1b` model (via the Ollama library) and Yahoo Finance API. This app processes natural language queries to retrieve stock data, including historical prices and the Price-to-Earnings (PE) ratio.\n\n### Features\n- **Natural Language Query Handling**: Users can input queries like \"Get 1 year stock prices of TCS,\" and the AI processes the query to determine the stock symbol and required data.\n- **Stock Price Retrieval**: Fetch historical stock prices for a specified duration using the Yahoo Finance API.\n- **PE Ratio Retrieval**: Get the current Price-to-Earnings ratio of a stock.\n- **Streamlit Integration**: A user-friendly interface for query input and displaying results.\n\n### Snaps:\n![1 year price](screenshots/1.png)\n![2](screenshots/2.png)\n![3](screenshots/3.png)\n![4](screenshots/4.png)\n![5](screenshots/5.png)\n---\n\n### Setup Instructions\n\n#### Prerequisites\n1. **Python 3.7+**\n2. Required libraries:\n   - `ollama`\n   - `yfinance`\n   - `pandas`\n   - `streamlit`\n\n#### Installation\n1. Clone the repository or save the script to your local machine.\n2. Install the required dependencies:\n   ```bash\n   pip install ollama yfinance pandas streamlit\n   ```\n\n#### Starting the App\n1. Run the Streamlit app:\n   ```bash\n   streamlit run src/trading_agent.py\n   ```\n2. Open the provided URL in your browser to interact with the app.\n\n---\n\n### Code Details\n\n#### Key Components\n1. **`get_stock_prices(symbol: str, duration: str) -\u003e pd.DataFrame`**:\n   - Fetches historical stock prices for a given symbol and duration.\n   - Uses Yahoo Finance API to query data.\n\n2. **`current_pe_ratio(symbol: str) -\u003e int`**:\n   - Retrieves the current Price-to-Earnings ratio of a stock using Yahoo Finance.\n\n3. **AI Integration**:\n   - The `llama3.2:1b` model processes the user's query and determines the required data.\n   - The model calls the appropriate Python functions (`get_stock_prices` or `current_pe_ratio`) using function calling capabilities provided by the Ollama library.\n\n4. **Streamlit Interface**:\n   - Accepts user input and displays the results interactively.\n\n---\n\n### How It Works\n1. **User Query**: The app accepts a natural language query about a stock.\n2. **AI Processing**: The query is passed to the `llama3.2:1b` model via the Ollama library.\n3. **Function Execution**:\n   - Based on the AI’s response, the appropriate function (`get_stock_prices` or `current_pe_ratio`) is executed.\n4. **Result Display**:\n   - If the function returns a DataFrame (e.g., stock prices), it is displayed in a table.\n   - For single values (e.g., PE ratio), the result is shown as text.\n\n---\n\n### Example Queries\n- \"Get 1 year stock prices of TCS.\"\n- \"What is the current PE ratio of Infosys?\"\n- \"Fetch 1 month stock prices for Reliance.\"\n\n---\n\n### Troubleshooting\n1. **Ollama Connection Issues**:\n   - Ensure Ollama is running locally.\n   - Verify the `llama3.2:1b` model is available and loaded in Ollama.\n2. **Yahoo Finance API Errors**:\n   - Confirm the stock symbol and duration are valid.\n   - Check your internet connection for API requests.\n\n---\n\n### Future Enhancements\n- Add support for multiple stock exchanges and suffixes.\n- Implement error handling for invalid queries or symbols.\n- Extend functionality to include other stock metrics, such as dividends or EPS.\n\nLet me know if you need further customization or clarification!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubhammandowara%2Fagents-from-scratch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshubhammandowara%2Fagents-from-scratch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubhammandowara%2Fagents-from-scratch/lists"}