Some updates to local embedding models and fixing a couple small issues

This commit is contained in:
Cole Medin 2025-02-27 07:31:02 -06:00
parent 4b40b00c7f
commit 9c4b17679b
4 changed files with 30 additions and 14 deletions

View File

@ -4,16 +4,17 @@
# OpenRouter: https://openrouter.ai/api/v1
BASE_URL=
# Get your Open AI API Key by following these instructions -
# https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key
# Even if using OpenRouter/Ollama, you still need to set this for the embedding model.
# Future versions of Archon will be more flexible with this.
OPENAI_API_KEY=
# For OpenAI: https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key
# For OpenRouter: https://openrouter.ai/keys
# For Ollama, no need to set this unless you specifically configured an API key
LLM_API_KEY=
# Get your Open AI API Key by following these instructions -
# https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key
# Even if using OpenRouter, you still need to set this for the embedding model.
# No need to set this if using Ollama.
OPENAI_API_KEY=
# For the Supabase version (sample_supabase_agent.py), set your Supabase URL and Service Key.
# Get your SUPABASE_URL from the API section of your Supabase project settings -
# https://supabase.com/dashboard/project/<your project ID>/settings/api
@ -34,6 +35,7 @@ REASONER_MODEL=
# Example: qwen2.5:14b-instruct-8k
PRIMARY_MODEL=
# Embedding model you want to use (nomic-embed-text:latest, text-embedding-3-small)
# Example: nomic-embed-text:latest
# Embedding model you want to use
# Example for Ollama: nomic-embed-text
# Example for OpenAI: text-embedding-3-small
EMBEDDING_MODEL=

View File

@ -8,8 +8,6 @@ The core remains an intelligent documentation crawler and RAG (Retrieval-Augment
This version supports both local LLMs with Ollama and cloud-based LLMs through OpenAI/OpenRouter.
Note: We still rely on OpenAI for embeddings, but future versions will add alternatives. I wanted to do this for v3 but MCP support tool a LOT of work to implement.
## Features
- MCP server support for AI IDE integration
@ -96,8 +94,9 @@ Be sure to restart your MCP server after finishing all steps.
OPENAI_API_KEY=your_openai_api_key
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_KEY=your_supabase_service_key
PRIMARY_MODEL=gpt-4o-mini # or your preferred OpenAI model for main agent
REASONER_MODEL=o3-mini # or your preferred OpenAI model for reasoning
PRIMARY_MODEL=your_main_coding_llm
REASONER_MODEL=your_reasoning_llm
EMBEDDING_MODEL=your_embedding_model
```
## Usage
@ -111,6 +110,8 @@ Execute the SQL commands in `utils/site_pages.sql` to:
In Supabase, do this by going to the "SQL Editor" tab and pasting in the SQL into the editor there. Then click "Run".
If using Ollama with the nomic-embed-text embedding model or another with 786 dimensions, either update site_pages.sql so that the dimensions are 768 instead of 1536 or use `utils/ollama_site_pages.sql`
### Crawl Documentation
To crawl and store documentation in the vector database:
@ -162,7 +163,7 @@ CREATE TABLE site_pages (
summary TEXT,
content TEXT,
metadata JSONB,
embedding VECTOR(1536)
embedding VECTOR(1536) -- Adjust dimensions as necessary (i.e. 768 for nomic-embed-text)
);
```

View File

@ -244,7 +244,20 @@ def get_pydantic_ai_docs_urls() -> List[str]:
print(f"Error fetching sitemap: {e}")
return []
async def clear_existing_records():
"""Clear all existing records with source='pydantic_ai_docs' from the site_pages table."""
try:
result = supabase.table("site_pages").delete().eq("metadata->>source", "pydantic_ai_docs").execute()
print("Cleared existing pydantic_ai_docs records from site_pages")
return result
except Exception as e:
print(f"Error clearing existing records: {e}")
return None
async def main():
# Clear existing records first
await clear_existing_records()
# Get URLs from Pydantic AI docs
urls = get_pydantic_ai_docs_urls()
if not urls:

View File

@ -45,7 +45,7 @@ def _make_request(thread_id: str, user_input: str, config: dict) -> str:
json={
"message": user_input,
"thread_id": thread_id,
"is_first_message": not active_threads[thread_id],
"is_first_message": not active_threads[thread_id],
"config": config
}
)