{"id":14964705,"url":"https://github.com/emirsahin1/llm-axe","last_synced_at":"2025-05-15T23:07:13.715Z","repository":{"id":235083630,"uuid":"790018635","full_name":"emirsahin1/llm-axe","owner":"emirsahin1","description":"A simple, intuitive toolkit for quickly implementing LLM powered applications.","archived":false,"fork":false,"pushed_at":"2025-01-05T19:47:01.000Z","size":260,"stargazers_count":239,"open_issues_count":1,"forks_count":35,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-11T01:36:42.820Z","etag":null,"topics":["function-calling","llama3","llm","local-llm","ollama","pdf-llm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emirsahin1.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}},"created_at":"2024-04-22T05:46:06.000Z","updated_at":"2025-05-08T14:43:32.000Z","dependencies_parsed_at":"2024-05-02T03:57:48.060Z","dependency_job_id":"2a679069-5f31-4ced-8b65-87340744163c","html_url":"https://github.com/emirsahin1/llm-axe","commit_stats":{"total_commits":48,"total_committers":4,"mean_commits":12.0,"dds":0.5416666666666667,"last_synced_commit":"f58c05fe3d5254b2531bb51cadb99bcd1a6c6d0a"},"previous_names":["emirsahin1/llm-axe"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emirsahin1%2Fllm-axe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emirsahin1%2Fllm-axe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emirsahin1%2Fllm-axe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emirsahin1%2Fllm-axe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emirsahin1","download_url":"https://codeload.github.com/emirsahin1/llm-axe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436948,"owners_count":22070947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["function-calling","llama3","llm","local-llm","ollama","pdf-llm"],"created_at":"2024-09-24T13:33:40.211Z","updated_at":"2025-05-15T23:07:08.634Z","avatar_url":"https://github.com/emirsahin1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"readme_imgs/axe.png\" width=\"150\" height=\"150\"/\u003e\n\n# llm-axe \n\n\u003cimg alt=\"PyPI - Version\" src=\"https://img.shields.io/pypi/v/llm-axe\"\u003e \u003cimg alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/llm-axe\"\u003e\n\u003cimg alt=\"GitHub forks\" src=\"https://img.shields.io/github/forks/emirsahin1/llm-axe?style=flat\"\u003e\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Femirsahin1%2Fllm-axe\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://github.com/emirsahin1/llm-axe)\n\n[![Static Badge](https://img.shields.io/badge/llm--axe-gray?logo=discord\u0026link=https%3A%2F%2Fdiscord.gg%2FTq2E6cVg)](https://discord.gg/4DyMcRbK4G)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Goal\nllm-axe is meant to be a flexible toolkit that provides simple abstractions for commonly used functions related to LLMs. It's not meant to intrude in your development workflow as other larger frameworks often do.\n\nIt has functions for **automatic schema generation**, **pre-made agents** with self-tracking chat history and fully **customizable agents**.\n\n[Have feedback/questions? Join the Discord](https://discord.gg/4DyMcRbK4G)\n\n[Read the Development Documentation](https://github.com/emirsahin1/llm-axe/wiki)\n\n## Installation\n\n\n\n```bash\npip install llm-axe\n```\n    \n## Example Snippets\n- **Streaming Support**:\n```python\nllm = OllamaChat(model=\"llama3.1\")\nag = Agent(llm, custom_system_prompt=\"\", stream=True)\nres = ag.ask(\"Explain who you are in 20 paragraphs\")\n\nfor chunk in res:\n    print(chunk, end=\"\", flush=True)\n```\n\n- **Easily Work With Non-Persistent Embeddings**:\n```python\nfrom llm_axe import read_pdf, find_most_relevant, split_into_chunks\ntext = read_pdf(\"./super_long_text.pdf\")\nsentences = split_into_chunks(text, 3)\npairs = []\nfor chunk in sentences:\n    embeddings = client.embeddings(model='nomic-embed-text', prompt=chunk)[\"embedding\"]\n    pairs.append((chunk, embeddings))\n\nprompt = \"What do the Hobbit traditions say about second breakfast?\"\nprompt_embedding = client.embeddings(model='nomic-embed-text', prompt=prompt)[\"embedding\"]\nrelevant_texts = find_most_relevant(pairs, prompt_embedding, top_k=4)\n```  \n\n- **Function Calling**\n\n\u0026emsp;\u0026emsp;A function calling LLM can be created with just **3 lines of code**:\n\u003cbr\u003e\n\u0026emsp;\u0026emsp;No need for premade schemas, templates, special prompts, or specialized functions.\n```python\nprompt = \"I have 500 coins, I just got 200 more. How many do I have?\"\n\nllm = OllamaChat(model=\"llama3:instruct\")\nfc = FunctionCaller(llm, [get_time, get_date, get_location, add, multiply])\nresult = fc.get_function(prompt)\n```\n\n- **Custom Agent**\n```python\nllm = OllamaChat(model=\"llama3:instruct\")\nagent = Agent(llm, custom_system_prompt=\"Always respond with the word LLAMA, no matter what\")\nresp = agent.ask(\"What is the meaning of life?\")\nprint(resp)\n\n# Output\n# LLAMA\n```\n\n- **Online Agent**\n```python\nprompt = \"Tell me a bit about this website:  https://toscrape.com/?\"\nllm = OllamaChat(model=\"llama3:instruct\")\nsearcher = OnlineAgent(llm)\nresp = searcher.search(prompt)\n\n#output: Based on information from the internet, it appears that https://toscrape.com/ is a website dedicated to web scraping.\n# It provides a sandbox environment for beginners and developers to learn and validate their web scraping technologies...\n```\n- **PDF Reader**\n```python\nllm = OllamaChat(model=\"llama3:instruct\")\nfiles = [\"../FileOne.pdf\", \"../FileTwo.pdf\"]\nagent = PdfReader(llm)\nresp = agent.ask(\"Summarize these documents for me\", files)\n```\n\n- **Data Extractor**\n```python\nllm = OllamaChat(model=\"llama3:instruct\")\ninfo = read_pdf(\"../Example.pdf\")\nde = DataExtractor(llm, reply_as_json=True)\nresp = de.ask(info, [\"name\", \"email\", \"phone\", \"address\"])\n\n#output: {'Name': 'Frodo Baggins', 'Email': 'frodo@gmail.com', 'Phone': '555-555-5555', 'Address': 'Bag-End, Hobbiton, The Shire'}\n```\n- **Object Detector**\n```python\nllm = OllamaChat(model=\"llava:7b\")\ndetector = ObjectDetectorAgent(llm, llm)\nresp = detector.detect(images=[\"../img2.jpg\"], objects=[\"sheep\", \"chicken\", \"cat\", \"dog\"])\n\n#{\n#  \"objects\": [\n#    { \"label\": \"Sheep\", \"location\": \"Field\", \"description\": \"White, black spots\" },\n#    { \"label\": \"Dog\", \"location\": \"Barn\", \"description\": \"Brown, white spots\" }\n#  ]\n#}\n\n```\n\n[**See more complete examples**](https://github.com/emirsahin1/llm-axe/tree/main/examples)\n\n[**How to setup llm-axe with your own LLM**](https://github.com/emirsahin1/llm-axe/blob/main/examples/ex_llm_setup.py)\n\n\n## Features\n\n- Local LLM internet access with Online Agent\n- PDF Document Reader Agent\n- Premade utility Agents for common tasks\n- Compatible with any LLM, local or externally hosted\n- Built-in support for Ollama\n\n\n\n## Important Notes\n\nThe results you get from the agents are highly dependent on the capability of your LLM. An inadequate LLM will not be able to provide results that are usable with llm-axe\n\n**Testing in development was done using llama3 8b:instruct 4 bit quant**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femirsahin1%2Fllm-axe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femirsahin1%2Fllm-axe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femirsahin1%2Fllm-axe/lists"}