-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from topoteretes/adding_ollama
Local embeddings + ollama
- Loading branch information
Showing
48 changed files
with
1,449 additions
and
2,917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,5 +165,6 @@ cython_debug/ | |
.vscode/ | ||
database/data/ | ||
cognee/data/ | ||
cognee/cache/ | ||
|
||
.DS_Store | ||
# .DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
A quantum computer is a computer that takes advantage of quantum mechanical phenomena. | ||
At small scales, physical matter exhibits properties of both particles and waves, and quantum computing leverages this behavior, specifically quantum superposition and entanglement, using specialized hardware that supports the preparation and manipulation of quantum states. | ||
Classical physics cannot explain the operation of these quantum devices, and a scalable quantum computer could perform some calculations exponentially faster (with respect to input size scaling)[2] than any modern "classical" computer. In particular, a large-scale quantum computer could break widely used encryption schemes and aid physicists in performing physical simulations; however, the current state of the technology is largely experimental and impractical, with several obstacles to useful applications. Moreover, scalable quantum computers do not hold promise for many practical tasks, and for many important tasks quantum speedups are proven impossible. | ||
The basic unit of information in quantum computing is the qubit, similar to the bit in traditional digital electronics. Unlike a classical bit, a qubit can exist in a superposition of its two "basis" states. When measuring a qubit, the result is a probabilistic output of a classical bit, therefore making quantum computers nondeterministic in general. If a quantum computer manipulates the qubit in a particular way, wave interference effects can amplify the desired measurement results. The design of quantum algorithms involves creating procedures that allow a quantum computer to perform calculations efficiently and quickly. | ||
Physically engineering high-quality qubits has proven challenging. If a physical qubit is not sufficiently isolated from its environment, it suffers from quantum decoherence, introducing noise into calculations. Paradoxically, perfectly isolating qubits is also undesirable because quantum computations typically need to initialize qubits, perform controlled qubit interactions, and measure the resulting quantum states. Each of those operations introduces errors and suffers from noise, and such inaccuracies accumulate. | ||
In principle, a non-quantum (classical) computer can solve the same computational problems as a quantum computer, given enough time. Quantum advantage comes in the form of time complexity rather than computability, and quantum complexity theory shows that some quantum algorithms for carefully selected tasks require exponentially fewer computational steps than the best known non-quantum algorithms. Such tasks can in theory be solved on a large-scale quantum computer whereas classical computers would not finish computations in any reasonable amount of time. However, quantum speedup is not universal or even typical across computational tasks, since basic tasks such as sorting are proven to not allow any asymptotic quantum speedup. Claims of quantum supremacy have drawn significant attention to the discipline, but are demonstrated on contrived tasks, while near-term practical use cases remain limited. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .config import config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from typing import Optional | ||
from cognee.infrastructure import infrastructure_config | ||
|
||
class config(): | ||
@staticmethod | ||
def data_path(data_path: Optional[str] = None) -> str: | ||
infrastructure_config.set_config({ | ||
"data_path": data_path | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,52 @@ | ||
from cognee.config import Config | ||
from .databases.relational import SqliteEngine, DatabaseEngine | ||
from .databases.vector import WeaviateAdapter, VectorDBInterface | ||
from .databases.vector.weaviate_db import WeaviateAdapter | ||
from .databases.vector.vector_db_interface import VectorDBInterface | ||
from .databases.vector.embeddings.DefaultEmbeddingEngine import DefaultEmbeddingEngine | ||
from .llm.llm_interface import LLMInterface | ||
from .llm.openai.adapter import OpenAIAdapter | ||
|
||
config = Config() | ||
config.load() | ||
|
||
class InfrastructureConfig(): | ||
data_path: str = config.data_path | ||
database_engine: DatabaseEngine = None | ||
vector_engine: VectorDBInterface = None | ||
llm_engine: LLMInterface = None | ||
|
||
def get_config(self) -> dict: | ||
if self.database_engine is None: | ||
self.database_engine = SqliteEngine(config.db_path, config.db_name) | ||
|
||
if self.llm_engine is None: | ||
self.llm_engine = OpenAIAdapter(config.openai_key, config.model) | ||
|
||
if self.vector_engine is None: | ||
self.vector_engine = WeaviateAdapter( | ||
config.weaviate_url, | ||
config.weaviate_api_key, | ||
config.openai_key | ||
embedding_engine = DefaultEmbeddingEngine() | ||
) | ||
|
||
return { | ||
"data_path": self.data_path, | ||
"llm_engine": self.llm_engine, | ||
"vector_engine": self.vector_engine, | ||
"database_engine": self.database_engine, | ||
"vector_engine": self.vector_engine | ||
} | ||
|
||
def set_config(self, new_config: dict): | ||
self.database_engine = new_config["database_engine"] | ||
self.vector_engine = new_config["vector_engine"] | ||
if "data_path" in new_config: | ||
self.data_path = new_config["data_path"] | ||
|
||
if "database_engine" in new_config: | ||
self.database_engine = new_config["database_engine"] | ||
|
||
if "vector_engine" in new_config: | ||
self.vector_engine = new_config["vector_engine"] | ||
|
||
if "llm_engine" in new_config: | ||
self.llm_engine = new_config["llm_engine"] | ||
|
||
infrastructure_config = InfrastructureConfig() |
Oops, something went wrong.