pave_ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +195 -0
- data/app/assets/stylesheets/pave_ai/application.css +15 -0
- data/app/controllers/pave_ai/application_controller.rb +4 -0
- data/app/helpers/pave_ai/application_helper.rb +4 -0
- data/app/jobs/pave_ai/application_job.rb +4 -0
- data/app/mailers/pave_ai/application_mailer.rb +6 -0
- data/app/models/pave_ai/application_record.rb +5 -0
- data/app/models/pave_ai/chat.rb +49 -0
- data/app/models/pave_ai/chat_message.rb +28 -0
- data/app/models/pave_ai/intent.rb +34 -0
- data/app/models/pave_ai/persona.rb +34 -0
- data/app/models/pave_ai/persona_document.rb +35 -0
- data/app/models/pave_ai/quota.rb +77 -0
- data/app/models/pave_ai/spend_log.rb +47 -0
- data/app/services/pave_ai/client/provider.rb +50 -0
- data/app/services/pave_ai/client/providers/anthropic.rb +15 -0
- data/app/services/pave_ai/client/providers/gemini.rb +15 -0
- data/app/services/pave_ai/client/providers/ollama.rb +16 -0
- data/app/services/pave_ai/client/providers/openai.rb +14 -0
- data/app/services/pave_ai/client/providers/openai_compatible.rb +18 -0
- data/app/services/pave_ai/client/providers/xai.rb +14 -0
- data/app/services/pave_ai/client/providers/zai.rb +13 -0
- data/app/services/pave_ai/client/providers/zen.rb +12 -0
- data/app/services/pave_ai/client.rb +683 -0
- data/app/services/pave_ai/credential.rb +66 -0
- data/app/services/pave_ai/governance.rb +70 -0
- data/app/services/pave_ai/rates.rb +101 -0
- data/app/services/pave_ai/spend.rb +539 -0
- data/app/views/layouts/pave_ai/application.html.erb +17 -0
- data/config/ai_governance/ETHICS.md +20 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20260404000001_create_pave_ai_tables.rb +102 -0
- data/db/migrate/20260820000002_add_billable_to_pave_ai_spend_logs.rb +5 -0
- data/db/migrate/20260827000001_add_model_to_pave_ai_spend_logs.rb +8 -0
- data/db/migrate/20260828000001_add_intent_credit_cost_and_log_credits.rb +10 -0
- data/db/migrate/20261123000001_remove_quota_limit_defaults.rb +9 -0
- data/lib/generators/pave_ai/install/install_generator.rb +61 -0
- data/lib/pave_ai/engine.rb +23 -0
- data/lib/pave_ai/middleware/request_cleanup.rb +17 -0
- data/lib/pave_ai/version.rb +3 -0
- data/lib/pave_ai.rb +247 -0
- data/lib/tasks/pave_ai_tasks.rake +4 -0
- metadata +127 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PaveAi
|
|
4
|
+
class Client::Providers::Ollama < Client::Provider
|
|
5
|
+
def provider_name = "ollama"
|
|
6
|
+
def chat_url = "#{PaveAi.config.ollama_url}/api/chat"
|
|
7
|
+
def api_key = nil
|
|
8
|
+
def openai_compatible? = false
|
|
9
|
+
def image_available? = false
|
|
10
|
+
def configured? = PaveAi.config.ollama_configured?
|
|
11
|
+
def default_model = PaveAi.config.ollama_model.presence || "llama3.1:8b"
|
|
12
|
+
def credit_cost = 0
|
|
13
|
+
# Keyless and platform-hosted; a caller's own endpoint is "openai_compatible".
|
|
14
|
+
def accepts_caller_credential? = false
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PaveAi
|
|
4
|
+
class Client::Providers::Openai < Client::Provider
|
|
5
|
+
def provider_name = "openai"
|
|
6
|
+
def chat_url = "https://api.openai.com/v1/chat/completions"
|
|
7
|
+
def image_url = "https://api.openai.com/v1/images/generations"
|
|
8
|
+
def api_key = PaveAi.config.openai_api_key
|
|
9
|
+
def configured? = PaveAi.config.openai_configured?
|
|
10
|
+
def default_model = "gpt-4o-mini"
|
|
11
|
+
def default_image_model = "dall-e-3"
|
|
12
|
+
def credit_cost = 2
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PaveAi
|
|
4
|
+
# Any OpenAI-compatible endpoint a caller brings: a hosted Llama, OpenRouter,
|
|
5
|
+
# a self-run gateway. It has no platform identity at all — no key, no base
|
|
6
|
+
# URL, no default model — so it exists only with a caller's Credential that
|
|
7
|
+
# carries its base URL.
|
|
8
|
+
class Client::Providers::OpenaiCompatible < Client::Provider
|
|
9
|
+
def provider_name = "openai_compatible"
|
|
10
|
+
def chat_url = nil
|
|
11
|
+
def api_key = nil
|
|
12
|
+
def image_available? = false
|
|
13
|
+
def configured? = false
|
|
14
|
+
def default_model = nil
|
|
15
|
+
def requires_caller_credential? = true
|
|
16
|
+
def accepts_api_base? = true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PaveAi
|
|
4
|
+
class Client::Providers::Xai < Client::Provider
|
|
5
|
+
def provider_name = "xai"
|
|
6
|
+
def chat_url = "https://api.x.ai/v1/chat/completions"
|
|
7
|
+
def image_url = "https://api.x.ai/v1/images/generations"
|
|
8
|
+
def api_key = PaveAi.config.xai_api_key
|
|
9
|
+
def configured? = PaveAi.config.xai_configured?
|
|
10
|
+
def default_model = "grok-4-1-fast-non-reasoning"
|
|
11
|
+
def default_image_model = "grok-imagine-image"
|
|
12
|
+
def credit_cost = 3
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PaveAi
|
|
4
|
+
class Client::Providers::Zai < Client::Provider
|
|
5
|
+
def provider_name = "zai"
|
|
6
|
+
def chat_url = "https://open.bigmodel.cn/api/paas/v4/chat/completions"
|
|
7
|
+
def image_url = "https://open.bigmodel.cn/api/paas/v4/images/generations"
|
|
8
|
+
def api_key = PaveAi.config.zai_api_key
|
|
9
|
+
def configured? = PaveAi.config.zai_configured?
|
|
10
|
+
def default_model = PaveAi.config.zai_model.presence || "glm-4.7-flash"
|
|
11
|
+
def default_image_model = "cogview-4"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PaveAi
|
|
4
|
+
class Client::Providers::Zen < Client::Provider
|
|
5
|
+
def provider_name = "zen"
|
|
6
|
+
def chat_url = "https://opencode.ai/zen/v1/chat/completions"
|
|
7
|
+
def api_key = PaveAi.config.zen_api_key
|
|
8
|
+
def image_available? = false
|
|
9
|
+
def configured? = PaveAi.config.zen_configured?
|
|
10
|
+
def default_model = PaveAi.config.zen_model.presence || "kimi-k2.5"
|
|
11
|
+
end
|
|
12
|
+
end
|