{"id":28561791,"url":"https://github.com/noclocks/noclocksai","last_synced_at":"2025-06-10T11:33:17.220Z","repository":{"id":280535558,"uuid":"942325729","full_name":"noclocks/noclocksai","owner":"noclocks","description":"No Clocks AI","archived":false,"fork":false,"pushed_at":"2025-05-21T21:15:14.000Z","size":1775,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-21T22:24:42.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noclocks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"codemeta.json","zenodo":null},"funding":{"custom":["https://www.paypal.me/noclocks","https://pay.noclocks.dev/b/7sI5o93U4gng9gs5kl"]}},"created_at":"2025-03-03T23:49:02.000Z","updated_at":"2025-05-21T21:15:18.000Z","dependencies_parsed_at":"2025-03-04T01:19:09.548Z","dependency_job_id":"e3cd5fa0-695a-4bea-b739-b2ef32bd521d","html_url":"https://github.com/noclocks/noclocksai","commit_stats":null,"previous_names":["noclocks/noclocksai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noclocks%2Fnoclocksai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noclocks%2Fnoclocksai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noclocks%2Fnoclocksai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noclocks%2Fnoclocksai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noclocks","download_url":"https://codeload.github.com/noclocks/noclocksai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noclocks%2Fnoclocksai/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259066660,"owners_count":22800173,"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":[],"created_at":"2025-06-10T11:30:46.229Z","updated_at":"2025-06-10T11:33:17.201Z","avatar_url":"https://github.com/noclocks.png","language":"R","funding_links":["https://www.paypal.me/noclocks","https://pay.noclocks.dev/b/7sI5o93U4gng9gs5kl"],"categories":[],"sub_categories":[],"readme":"# noclocksai \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"120\" alt=\"\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/noclocks/noclocksai)\n![](https://badge.mcpx.dev?type=dev 'MCP Dev')\n[![GitMCP](https://img.shields.io/endpoint?url=https://gitmcp.io/badge/noclocks/noclocksai)](https://gitmcp.io/noclocks/noclocksai/chat)\n\n[![Test Coverage](https://github.com/noclocks/noclocksai/actions/workflows/coverage.yml/badge.svg)](https://github.com/noclocks/noclocksai/actions/workflows/coverage.yml)\n[![R-CMD-Check](https://github.com/noclocks/noclocksai/actions/workflows/rcmdcheck.yml/badge.svg)](https://github.com/noclocks/noclocksai/actions/workflows/rcmdcheck.yml)\n[![Automate Changelog](https://github.com/noclocks/noclocksai/actions/workflows/changelog.yml/badge.svg)](https://github.com/noclocks/noclocksai/actions/workflows/changelog.yml)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nThe `noclocksai` package provides a comprehensive toolkit for working with AI services at No Clocks, LLC. It simplifies interactions with various AI models, provides utilities for embedding, database operations, and includes a flexible agent framework for creating AI assistants.\n\n## Key Features\n\n- **Agent Framework**: Create and manage AI agents with memory, tools, and vector store capabilities\n- **Chat Interfaces**: Simplified interactions with popular AI providers (OpenAI, Claude, Gemini)\n- **Embeddings**: Generate and manage vector embeddings for RAG applications\n- **Database Integration**: Store and retrieve embeddings and documents\n- **API Connectors**: Wrappers for OpenAI, Google Maps, Geocoding, FireCrawl, and more\n- **Utility Functions**: Tools for caching, logging, data extraction, and markdown processing\n- **Mermaid Diagrams**: Generate mermaid.js diagrams with natural language\n- **Configuration Management**: Secure API key and environment management\n\n## AI \u0026 Agentic Capabilities\n\n### LLM Provider Integrations\n\n- **OpenAI**: GPT-4o, GPT-4, and other models\n- **Anthropic**: Claude models\n- **Google**: Gemini models\n- **Ollama**: Local model hosting\n- **Groq**: High-performance inference\n\n### AI Agents\n\n- **Base Agent**: R6 class with memory, tools, and vector store capabilities\n- **Specialized Agents**:\n  - **EDA Agent**: For exploratory data analysis and anomaly detection\n  - **Mermaid Agent**: For generating diagrams from natural language\n  - **Git Agent**: For repository management and commit messages\n\n### Included Prompt Templates\n\n- **Code Analysis**: For analyzing and explaining code\n- **Document Processing**: For document summarization and analysis\n- **Exploratory Data Analysis**: For statistical analysis\n- **Markdown Enhancement**: For improving markdown documents\n- **Git Commits**: For generating commit messages\n- **Synthetic Data**: For generating sample data\n- **SQL to Text**: For explaining SQL queries\n- **Execute R Code**: For safe code execution\n- **Anomaly Detection**: For identifying outliers in data\n\n### AI Tools\n\n- **Code Tools**: Extract, format, and execute code\n- **Data Analysis**: Anomaly detection, correlation analysis\n- **Geospatial**: Google Maps integration, geocoding, weather data\n- **Database**: Query execution with LLM assistance\n- **Time \u0026 Date**: Timezone-aware functions\n\n### External API Integrations\n\n- **OpenWeather**: Weather data retrieval by coordinates or location\n- **Google Maps**: Geocoding, place search, and location data\n- **FireCrawl**: Web scraping and crawling capabilities\n- **Langfuse**: Comprehensive LLM observability and analytics\n  - Trace chat sessions\n  - Record user feedback\n  - Manage prompt templates\n  - Create evaluation datasets\n  - Run experiments\n\n### Type System\n\nThe package includes a robust type system for parameter validation:\n\n- **Primitive Types**: String, number, integer, boolean, array, object\n- **Complex Types**: For specialized data formats\n  - `type_gmaps_geocode_response`: Google Maps geocoding responses\n  - `type_gmaps_places_search_response`: Places API responses\n  - `type_dataset_docs`: Document dataset format\n\n## Installation\n\nYou can install the development version of noclocksai from GitHub:\n\n```R\npak::pak(\"noclocks/noclocksai\")\n```\n\n### System Requirements\n\nThis package requires:\n- R 4.1 or later\n- Node.js with npm/npx (for certain features)\n- Database connections (for vector stores)\n\n## Basic Usage\n\n### Creating a Chat Agent\n\n```r\nlibrary(noclocksai)\n\n# Initialize a simple chat\nchat \u003c- initialize_chat(\n  model = \"gpt-4o\",\n  system_prompt = \"You are a helpful AI assistant.\"\n)\n\n# Chat with the agent\nchat$chat(\"What is the R programming language?\")\n```\n\n### Using Geocoding and Weather APIs\n\nBelow is an example of registering some tools for the chat agent to use:\n\n```r\nregister_tools(\n  chat,\n  tools = list(\n    tool_current_time(),\n    tool_geocode_location(),\n    tool_get_weather()\n  )\n)\n# ✔ Successfully registered tool: get_current_time\n# ✔ Successfully registered tool: geocode_location\n# ✔ Successfully registered tool: get_weather\n# ✔ Successfully registered 3 tools.\n```\n\nNow you can ask the agent about the current time or weather:\n\n```r\n# chat with tools\nchat$chat(\"What is the current time?\")\n# [1] \"The current time is 21:06:05 EDT on March 21, 2025.\"\nchat$chat(\"What is the weather in Atlanta?\")\n# [1] \"The current weather in Atlanta is clear with a temperature of 11.75°C. The wind is blowing at 2.75 m/s from the west, and the humidity is 34%.\"\n```\n\n### Creating Mermaid Diagrams\n\n```r\n# initialize agent\nmermaid_agent \u003c- initialize_chat(system_prompt = prompt_mermaid_sys())\n\n# example code for a diagram\nexample \u003c- \"starwars |\u003e\n  group_by(species) |\u003e\n  summarise(\n    n = n(),\n    mass = mean(mass, na.rm = TRUE)\n  ) |\u003e\n  filter(\n    n \u003e 1,\n    mass \u003e 50\n  )\"\n\n# prompt for mermaid diagram\nresp \u003c- create_mermaid_diagram(\n  mermaid_agent,\n  prompt_mermaid_user(code = example)\n)\nresp\n#```mermaid\n#graph TD\n#    A[starwars dataset] --\u003e B[Group by species]\n#    B --\u003e C[Summarise]\n#    C --\u003e|Calculate n = count of species| D\n#    C --\u003e|Calculate mass = mean mass of species| D\n#    D --\u003e E[Filter]\n#    E --\u003e|n \u003e 1| F[Filtered Data]\n#    E --\u003e|mass \u003e 50| F[Filtered Data]\n#```\n\n# extract code \u0026 render diagram\nextract_code(resp, \"mermaid\") |\u003e Diagrammer::Diagrammer()\n```\n\n\u003ccenter\u003e\n\n![mermaid-diagram-example](man/figures/mermaid.png)\n\n\n\u003c/center\u003e\n\n\n### Extracting Code from Text\n\n```r\ntext \u003c- \"Here's an example:\n```r\nlibrary(dplyr)\nmtcars |\u003e\n  group_by(cyl) |\u003e\n  summarise(avg_mpg = mean(mpg))\n```\"\n\n# Extract the R code\ncode \u003c- extract_code(text, lang = \"r\")\n```\n\n### Working with PostgreSQL Databases\n\n```r\n# Connect to a PostgreSQL database\nconn \u003c- db_connect(list(\n  driver = \"PostgreSQL\",\n  host = \"localhost\",\n  dbname = \"my_database\",\n  user = \"postgres\",\n  password = \"password\",\n  port = 5432\n))\n\n# Query the database and store documents for vector search\ndb_store_document(\n  conn,\n  title = \"Sample Document\",\n  content = \"This is a sample document for vector search.\",\n  metadata = list(author = \"Jane Doe\", date = Sys.Date())\n)\n\n# Retrieve documents using semantic search\nresults \u003c- db_get_documents(conn, \"sample vector search\")\n```\n\n### Complex Workflow Example\n\nThe following example shows how to create an agent that uses multiple tools:\n\n```r\n# Create an agent with vector store capabilities\nagent \u003c- Agent$new(\n  provider = \"openai\",\n  model = \"gpt-4o\",\n  system_prompt = \"You are an assistant that helps analyze real estate data.\",\n  name = \"real-estate-assistant\"\n)\n\n# Register external API tools with the agent\nagent$register_tool(tool_geocode_location())\nagent$register_tool(tool_get_weather())\nagent$register_tool(tool_gmaps_places_search())\n\n# Connect the agent to a database for document storage\nagent$db_connect(db_config = list(\n  driver = \"PostgreSQL\",\n  host = \"34.75.86.90\",\n  dbname = \"gmh_leasing_dev\",\n  user = \"postgres\",\n  password = \"password\",\n  port = 5432\n))\n\n# Add a resource to the agent\nagent$add_resource(\n  name = \"market_data\",\n  content = read.csv(\"market_data.csv\"),\n  type = \"dataframe\"\n)\n\n# Ask the agent a question that requires using multiple tools\nresponse \u003c- agent$chat(\n  \"What are the current market conditions for apartment rentals in New York City,\n  and how might the current weather impact showings this weekend?\"\n)\n\n# Save the agent state for later use\nagent$save_state(\"agent_state.rds\")\n```\n\n## Documentation\n\nFor more detailed information, see the package vignettes:\n\n```r\n# List available vignettes\nvignette(package = \"noclocksai\")\n\n# View a specific vignette\nvignette(\"noclocksai\", package = \"noclocksai\")\n```\n\n## License\n\nThis package is licensed under a proprietary license - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nThis package is primarily maintained by [No Clocks, LLC](https://noclocks.dev). Please file issues for bugs or feature requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoclocks%2Fnoclocksai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoclocks%2Fnoclocksai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoclocks%2Fnoclocksai/lists"}