diff --git a/src/intelligence_layer/connectors/document_index/document_index.py b/src/intelligence_layer/connectors/document_index/document_index.py index 5b83a5acc..1ee8539a8 100644 --- a/src/intelligence_layer/connectors/document_index/document_index.py +++ b/src/intelligence_layer/connectors/document_index/document_index.py @@ -438,36 +438,6 @@ class DocumentIndexClient: Args: token: A valid token for the document index API. base_document_index_url: The url of the document index' API. - - Example: - >>> import os - - >>> from intelligence_layer.connectors import ( - ... CollectionPath, - ... DocumentContents, - ... DocumentIndexClient, - ... DocumentPath, - ... SearchQuery, - ... ) - - >>> document_index = DocumentIndexClient(os.getenv("AA_TOKEN")) - >>> collection_path = CollectionPath( - ... namespace="aleph-alpha", collection="wikipedia-de" - ... ) - >>> document_index.create_collection(collection_path) - >>> document_index.add_document( - ... document_path=DocumentPath( - ... collection_path=collection_path, document_name="Fun facts about Germany" - ... ), - ... contents=DocumentContents.from_text("Germany is a country located in ..."), - ... ) - >>> search_result = document_index.search( - ... collection_path=collection_path, - ... index_name="asymmetric", - ... search_query=SearchQuery( - ... query="What is the capital of Germany", max_results=4, min_score=0.5 - ... ), - ... ) """ def __init__( diff --git a/src/intelligence_layer/examples/qa/long_context_qa.py b/src/intelligence_layer/examples/qa/long_context_qa.py index b7f401a95..80de61a21 100644 --- a/src/intelligence_layer/examples/qa/long_context_qa.py +++ b/src/intelligence_layer/examples/qa/long_context_qa.py @@ -55,11 +55,11 @@ class LongContextQa(Task[LongContextQaInput, MultipleChunkQaOutput]): model: The model used in the task. Example: - >>> from intelligence_layer.core import InMemoryTracer + >>> from intelligence_layer.core import InMemoryTracer, LuminousControlModel >>> from intelligence_layer.examples import LongContextQa, LongContextQaInput - - >>> task = LongContextQa() + >>> model = LuminousControlModel("luminous-base-control") + >>> task = LongContextQa(model=model) >>> input = LongContextQaInput(text="Lengthy text goes here...", ... question="Where does the text go?") >>> tracer = InMemoryTracer() diff --git a/src/intelligence_layer/examples/qa/multiple_chunk_qa.py b/src/intelligence_layer/examples/qa/multiple_chunk_qa.py index af5124d22..f31eea047 100644 --- a/src/intelligence_layer/examples/qa/multiple_chunk_qa.py +++ b/src/intelligence_layer/examples/qa/multiple_chunk_qa.py @@ -141,15 +141,15 @@ class MultipleChunkQa(Task[MultipleChunkQaInput, MultipleChunkQaOutput]): >>> from intelligence_layer.connectors import ( ... LimitedConcurrencyClient, ... ) - >>> from intelligence_layer.core import Language, InMemoryTracer + >>> from intelligence_layer.core import Language, InMemoryTracer, LuminousControlModel >>> from intelligence_layer.core.chunk import TextChunk >>> from intelligence_layer.examples import ( ... MultipleChunkQa, ... MultipleChunkQaInput, ... ) - - >>> task = MultipleChunkQa() + >>> model = LuminousControlModel("luminous-base-control") + >>> task = MultipleChunkQa(merge_answers_model=model) >>> input = MultipleChunkQaInput( ... chunks=[TextChunk("Tina does not like pizza."), TextChunk("Mike is a big fan of pizza.")], ... question="Who likes pizza?", diff --git a/src/intelligence_layer/examples/qa/retriever_based_qa.py b/src/intelligence_layer/examples/qa/retriever_based_qa.py index 55079e929..145249e88 100644 --- a/src/intelligence_layer/examples/qa/retriever_based_qa.py +++ b/src/intelligence_layer/examples/qa/retriever_based_qa.py @@ -71,22 +71,6 @@ class RetrieverBasedQa( retriever: Used to access and return a set of texts. multi_chunk_qa: The task that is used to generate an answer for a single chunk (retrieved through the retriever). Defaults to :class:`MultipleChunkQa` . - - Example: - >>> import os - >>> from intelligence_layer.connectors import DocumentIndexClient - >>> from intelligence_layer.connectors import DocumentIndexRetriever - >>> from intelligence_layer.core import InMemoryTracer - >>> from intelligence_layer.examples import RetrieverBasedQa, RetrieverBasedQaInput - - - >>> token = os.getenv("AA_TOKEN") - >>> document_index = DocumentIndexClient(token) - >>> retriever = DocumentIndexRetriever(document_index, "asymmetric", "aleph-alpha", "wikipedia-de", 3) - >>> task = RetrieverBasedQa(retriever) - >>> input_data = RetrieverBasedQaInput(question="When was Rome founded?") - >>> tracer = InMemoryTracer() - >>> output = task.run(input_data, tracer) """ def __init__( diff --git a/src/intelligence_layer/examples/qa/single_chunk_qa.py b/src/intelligence_layer/examples/qa/single_chunk_qa.py index 26fc205a3..8f18bf4b5 100644 --- a/src/intelligence_layer/examples/qa/single_chunk_qa.py +++ b/src/intelligence_layer/examples/qa/single_chunk_qa.py @@ -104,11 +104,10 @@ class SingleChunkQa(Task[SingleChunkQaInput, SingleChunkQaOutput]): Example: >>> import os - >>> from intelligence_layer.core import Language, InMemoryTracer - >>> from intelligence_layer.core import TextChunk + >>> from intelligence_layer.core import Language, InMemoryTracer, TextChunk, LuminousControlModel >>> from intelligence_layer.examples import SingleChunkQa, SingleChunkQaInput - >>> - >>> task = SingleChunkQa() + >>> model = LuminousControlModel("luminous-base-control") + >>> task = SingleChunkQa(model=model) >>> input = SingleChunkQaInput( ... chunk=TextChunk("Tina does not like pizza. However, Mike does."), ... question="Who likes pizza?", diff --git a/src/intelligence_layer/examples/search/search.py b/src/intelligence_layer/examples/search/search.py index babeac927..148a592a6 100644 --- a/src/intelligence_layer/examples/search/search.py +++ b/src/intelligence_layer/examples/search/search.py @@ -46,25 +46,6 @@ class Search(Generic[ID], Task[SearchInput, SearchOutput[ID]]): Args: retriever: Implements logic to retrieve matching texts to the query. - - Example: - >>> from os import getenv - >>> from intelligence_layer.connectors import ( - ... DocumentIndexClient, - ... ) - >>> from intelligence_layer.connectors import ( - ... DocumentIndexRetriever, - ... ) - >>> from intelligence_layer.core import InMemoryTracer - >>> from intelligence_layer.examples import Search, SearchInput - - - >>> document_index = DocumentIndexClient(getenv("AA_TOKEN")) - >>> retriever = DocumentIndexRetriever(document_index, "asymmetric", "aleph-alpha", "wikipedia-de", 3) - >>> task = Search(retriever) - >>> input = SearchInput(query="When did East and West Germany reunite?") - >>> tracer = InMemoryTracer() - >>> output = task.run(input, tracer) """ def __init__(self, retriever: BaseRetriever[ID]):