diff --git a/.claude/skills/cognee-integrations/SKILL.md b/.claude/skills/cognee-integrations/SKILL.md index 1e6b75297a..22910c683e 100644 --- a/.claude/skills/cognee-integrations/SKILL.md +++ b/.claude/skills/cognee-integrations/SKILL.md @@ -1,6 +1,6 @@ --- name: cognee-integrations -description: Use when the user wants to connect cognee to external services — switching LLM or embedding providers (OpenAI, Azure, Gemini, Anthropic, Ollama, OpenRouter), changing databases (Postgres, PGVector, Neo4j, Neptune, Turso), S3 storage, or the MCP server for IDE integration. +description: Use when the user wants to connect cognee to external services — switching LLM or embedding providers (OpenAI, Azure, Gemini, Anthropic, Ollama, OpenRouter, aimlapi.com), changing databases (Postgres, PGVector, Neo4j, Neptune, Turso), S3 storage, or the MCP server for IDE integration. --- # Set up cognee integrations @@ -16,6 +16,7 @@ Default is OpenAI (`LLM_API_KEY` is all you need). To switch, set `LLM_PROVIDER`, `LLM_MODEL`, `LLM_API_KEY`, and (where relevant) `LLM_ENDPOINT` / `LLM_API_VERSION`: +- **aimlapi.com**: `LLM_PROVIDER=custom`, `LLM_MODEL=aiml/`, `LLM_ENDPOINT=https://api.aimlapi.com/v1`. Embeddings drop the `aiml/` prefix (litellm has no aiml embedding route) and rely on `EMBEDDING_ENDPOINT` instead. - **Azure OpenAI**: `LLM_PROVIDER=azure`, `LLM_MODEL=azure/gpt-4o-mini`, endpoint + api version required. - **Gemini** (no extra needed): `LLM_PROVIDER=gemini`, `LLM_MODEL=gemini/gemini-2.0-flash-exp`. - **Anthropic** (`cognee[anthropic]`): `LLM_PROVIDER=anthropic`, model e.g. `claude-3-5-sonnet-20241022`. diff --git a/.env.template b/.env.template index 500c1adf19..3cbcf524f7 100644 --- a/.env.template +++ b/.env.template @@ -781,6 +781,28 @@ WEB_SCRAPER_MAX_DELAY=10.0 # Uncomment + fill values to switch providers. ############################################################################### +########## aimlapi.com ######################################################## +# OpenAI-compatible gateway; litellm routes it under the "aiml/" prefix, so no +# extra install is needed. LLM_PROVIDER must be "custom" -- an "aiml/" prefix on +# its own raises ProviderNotDeducibleError, exactly like "openrouter/". +# Catalogue: https://api.aimlapi.com/v1/models?include=all +# Note: litellm's own env var for this provider is AIML_API_KEY, but cognee +# never reads it -- cognee passes api_key to litellm explicitly, so the key +# must be in LLM_API_KEY (setting only AIML_API_KEY raises LLMAPIKeyNotSetError). +#LLM_API_KEY="< None: + print("\n" + "=" * 78) + print(title) + print("=" * 78) + + +async def main() -> None: + if not os.environ.get("LLM_API_KEY"): + raise SystemExit("Export LLM_API_KEY with your aimlapi.com key before running.") + + # Start from a clean slate in isolated directory + await cognee.prune.prune_data() + await cognee.prune.prune_system(metadata=True) + + banner("REMEMBER USING AIMLAPI.COM") + llm_config = get_llm_config() + print(f"Using LLM: {llm_config.llm_model}") + print(f"Using Embeddings: {os.environ.get('EMBEDDING_MODEL')}") + + await cognee.remember(SAMPLE_TEXT, dataset_name="aimlapi_demo", self_improvement=False) + print("Knowledge graph built successfully.") + + banner("RECALL") + query = "What does Cognee help developers do?" + results = await cognee.recall( + query_text=query, + query_type=SearchType.GRAPH_COMPLETION, + datasets=["aimlapi_demo"], + ) + print(f"Query: {query}") + print("Recall Results:") + print(results[0].text if results else "") + + +if __name__ == "__main__": + asyncio.run(main())