{"id":15012926,"url":"https://github.com/ugurkantech/archnetai","last_synced_at":"2026-01-04T12:30:53.118Z","repository":{"id":236340076,"uuid":"777811741","full_name":"UgurkanTech/ArchNetAI","owner":"UgurkanTech","description":"ArchNetAI is a Python library that leverages the Ollama API for generating AI-powered content.","archived":false,"fork":false,"pushed_at":"2024-05-22T18:16:58.000Z","size":1353,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-22T19:35:52.787Z","etag":null,"topics":["ai","json-schema","llama","llava","ollama","ollama-api","phi3","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UgurkanTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-03-26T14:47:54.000Z","updated_at":"2024-05-22T19:35:55.379Z","dependencies_parsed_at":"2024-05-22T19:50:15.140Z","dependency_job_id":null,"html_url":"https://github.com/UgurkanTech/ArchNetAI","commit_stats":null,"previous_names":["ugurkantech/archnetai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UgurkanTech%2FArchNetAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UgurkanTech%2FArchNetAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UgurkanTech%2FArchNetAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UgurkanTech%2FArchNetAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UgurkanTech","download_url":"https://codeload.github.com/UgurkanTech/ArchNetAI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244583039,"owners_count":20476233,"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":["ai","json-schema","llama","llava","ollama","ollama-api","phi3","python"],"created_at":"2024-09-24T19:43:25.268Z","updated_at":"2026-01-04T12:30:53.050Z","avatar_url":"https://github.com/UgurkanTech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ArchNetAI\n\nArchNetAI is a Python library that leverages the Ollama API for generating AI-powered content.\n\nCreated by [UgurkanTech](https://github.com/UgurkanTech)\n\n## Streamlit Example\n\n\u003cimg width=\"1007\" alt=\"archnet\" src=\"https://github.com/UgurkanTech/ArchNetAI/assets/39236929/36c8e30a-d914-49e2-a551-53076c5e069b\"\u003e\n\n\n## Setup\n\nTo install the NetNode module, Install [Ollama](https://ollama.com/) then navigate to the `setup.py` containing directory and run the following command:\n\n```bash\npip3 install .\n```\n\n## Features\n\n- **ChatModel:** A module for generating AI-powered chat responses. This module can be used to create a conversational AI assistant that can respond to user queries and engage in natural language conversations. ChatModel supports chat history and data input.\n\n- **DataModel:** A module for generating random data. This module provides functions to generate random data such as names, addresses, phone numbers, and more. It can be useful for testing and generating sample data for applications.\n\n- **ImageModel:** An image analysis module for explaining images and classifying them. This module uses LLAVA models to analyze images and provide explanations for the content of the images. It can also classify images into different categories or labels.\n\n- **InstructorModel:** A utility for populating JSON and object templates with data. This module provides functions to fill JSON and object templates with data, making it easier to generate dynamic JSON files and create instances of objects with predefined properties and values.\n\nThese modules provide powerful functionality for AI-powered content generation, data manipulation, image analysis, and template filling. They can be used individually or in combination to build sophisticated AI applications.\n\n# Examples\n\nHere are some examples of how to use ArchNetAI:\n\n**ChatModel Example**\n```python\nfrom NetNode import *\n#Initialize model\nmodel = NetModelFactory.createModel(NetModelType.CHAT, model=\"phi3\")\n#Set options\noptions = Options(temperature=1, top_k=64, top_p=0.9, repeat_penalty=1.2, stream=True)\nmodel.setOptions(options)\n#Start interactive mode\nmodel.getResponse(resultType=ResultType.INTERACTIVE)\n```\n\n**ImageModel Example**\n```python\nfrom NetNode import *\n#Initialize model\nmodel = NetModelFactory.createModel(NetModelType.IMAGE, model=\"llava\")\n#Set options\nmodel.options.setImage(\"image.png\")\nmodel.options.setStreaming(True)\n#Create model response\nmodel.createModelResponse(\"Explain this image.\")\n#Print results\nmodel.getResponse(resultType=ResultType.STREAM)\n```\n\n**InstructorModel Object Fill Example**\n\n```python\nfrom NetNode import *\nfrom pydantic import BaseModel, Field\n#Initialize model\nmodel = NetModelFactory.createModel(NetModelType.INSTRUCTOR, model=\"phi3\")\n#Define BaseModel\nclass Cat(BaseModel):\n    fact: str = Field(..., description=\"A fact about cats.\")\n#Set BaseModel\nmodel.options.setBaseModel(Cat)\n#Create model response\nmodel.createModelResponse(\"Write a short cat fact about cat colors.\")\n#Get result object\ncat = model.getResponse(resultType=ResultType.OBJECT)\n#Print object's variable\nprint(cat.fact)\n```\n\n\n**DataModel Example**\n```python\nfrom NetNode import *\n#Initialize model\nmodel = NetModelFactory.createModel(NetModelType.DATA, model=\"phi3\")\n#Create model response\nmodel.createModelResponse(\"write one sentence cat fact about cat breeds.\")\n#Print results\nprint(model.getResponse(resultType=ResultType.STRING))\n```\n\n\n**Embedding Usage**\n```python\nfrom NetNode import *\n#Initialize model\nmodel = NetModelFactory.createModel(NetModelType.CHAT, model=\"phi3\")\n#Embed data\nmodel_embed = NetModelFactory.createModel(NetModelType.EMBED, model=\"all-minilm\")\nemb = Embedder(model_embed, vector_base=SQLiteVectorBase(), n_ctx=512)\n# Embed some text\nemb.embed(\"Hello world\", InputType.TEXT)\nemb.embed(\"ArchNet uses ollama API.\", InputType.TEXT)\n# Embed a file\nemb.embed(\"data.txt\", InputType.FILE_PATH)\n\n# Find best matches\nresult = emb.find_best_matches(prompt, 3)\ndata = \"\"\nfor match in result:\n    data += emb.get_file_context_from_part(match[0], match[1]) + \"\\n\"\n\nctx = ChatContext(512, 128)\nctx.setData(data)\nctx.setSystemPrompt(\"Using context, Answer the user's question.\")\nprompt = \"What is ArchNet? Briefly.\"\nctx.history.push_message(ChatMessage(Sender.USER, prompt))\nctx.updateContext()\n#Create model response\nmodel.createModelResponse(ctx.context.getContextDict())\n#Print results\nprint(model.getResponse(resultType=ResultType.STRING) + \"\\n\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fugurkantech%2Farchnetai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fugurkantech%2Farchnetai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fugurkantech%2Farchnetai/lists"}