This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into v0.1-e2e-tests
- Loading branch information
Showing
34 changed files
with
321 additions
and
91 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
tokenizer: | ||
type: OpenAITokenizer | ||
params: | ||
model_name: gpt-3.5-turbo | ||
|
||
knowledge_base: | ||
params: | ||
default_top_k: 5 | ||
|
||
record_encoder: | ||
type: OpenAIEncoder | ||
params: | ||
model_name: "text-embedding-ada-002" | ||
batch_size: 100 | ||
|
||
chunker: | ||
type: MarkdownChunker | ||
params: | ||
chunk_size: 256 | ||
chunk_overlap: 0 | ||
keep_separator: true | ||
|
||
context_engine: | ||
context_builder: | ||
type: StuffingContextBuilder | ||
|
||
params: | ||
global_metadata_filter: null # An optional metadata filter to apply to all queries | ||
|
||
llm: | ||
type: OpenAILLM | ||
params: | ||
model_name: gpt-3.5-turbo | ||
model_params: null # Model-specific parameters. May change depending on the model. | ||
|
||
chat_engine: | ||
params: | ||
max_prompt_tokens: 3000 | ||
max_generated_tokens: null # Will use the LLM's default max generated tokens | ||
max_context_tokens: 2500 | ||
system_prompt: null # Will use the default system prompt | ||
history_pruning: recent # Options: [raise, recent] | ||
min_history_messages: 1 | ||
|
||
query_builder: | ||
type: FunctionCallingQueryGenerator | ||
params: | ||
top_k: 5 | ||
prompt: null # Will use the default prompt | ||
function_description: null # Will use the default function description |
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,12 @@ | ||
knowledge_base: {} # This is a mandatory field, it will initialize the default KnowledgeBase class | ||
|
||
context_engine: {} # This is a mandatory field, it will initialize the default ContextEngine class | ||
|
||
# The `llm` field is optional. If it's not passed - no LLM will be initialized (see context_engine_only.yaml) | ||
llm: | ||
type: OpenAILLM | ||
params: | ||
model_name: gpt-3.5-turbo | ||
|
||
# The `chat_engine` field is optional (see context_engine_only.yaml) | ||
chat_engine: {} |
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .base import RecordEncoder | ||
from .dense_record_encoder import DenseRecordEncoder | ||
from .dense import DenseRecordEncoder | ||
from .openai import OpenAIRecordEncoder |
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,25 @@ | ||
from typing import List | ||
|
||
from pinecone_text.dense.openai_encoder import OpenAIEncoder | ||
from resin.knoweldge_base.models import KBDocChunk, KBEncodedDocChunk, KBQuery | ||
from resin.knoweldge_base.record_encoder.dense import DenseRecordEncoder | ||
from resin.models.data_models import Query | ||
|
||
|
||
class OpenAIRecordEncoder(DenseRecordEncoder): | ||
|
||
def __init__(self, | ||
*, | ||
model_name: str = "text-embedding-ada-002", | ||
batch_size: int = 100, | ||
**kwargs): | ||
encoder = OpenAIEncoder(model_name) | ||
super().__init__(dense_encoder=encoder, batch_size=batch_size, **kwargs) | ||
|
||
async def _aencode_documents_batch(self, | ||
documents: List[KBDocChunk] | ||
) -> List[KBEncodedDocChunk]: | ||
raise NotImplementedError | ||
|
||
async def _aencode_queries_batch(self, queries: List[Query]) -> List[KBQuery]: | ||
raise NotImplementedError |
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
File renamed without changes.
Oops, something went wrong.