Core Types
The core logic custom types.
Type Aliases
DomainKey = Literal["usability", "io", "description", "execution", "parametric", "error"]
OptionKey = Literal[ "loader", "chunking_config", "embedding_model", "vector_store", "similarity_top_k", "llm", "mode"]
GitFilter
Bases: Enum
Enum delineating between the directory and file extension filters.
Attributes:
Name | Type | Description |
---|---|---|
DIRECTORY |
int
|
A git directory filter, represented by the value 1. |
FILE_EXTENSION |
int
|
A file extension filter, represented by the value 2. |
Source code in bcorag/custom_types/core_types.py
GitFilters
Bases: TypedDict
Typed dict for github loader filters.
Attributes:
Name | Type | Description |
---|---|---|
filter_type |
FilterType
|
The type of github filter (whether it is an include or exclude filter). |
filter |
GitFilter
|
The filter enum specification. |
value |
list[str]
|
The values to filter on. |
Source code in bcorag/custom_types/core_types.py
GitData
Bases: TypedDict
Typed dict for the optional git repo information.
Attributes:
Name | Type | Description |
---|---|---|
user |
str
|
The github repo owner. |
repo |
str
|
The repo name. |
branch |
str
|
The repo branch to index. |
filters |
list[GitFilters]
|
The list of filters to apply. |
Source code in bcorag/custom_types/core_types.py
UserSelections
Bases: TypedDict
Types dict for the user selections.
Attributes:
Name | Type | Description |
---|---|---|
llm |
str
|
The LLM to use. |
embedding_model |
str
|
The embedding model to use. |
filename |
str
|
The file name of the paper being processed. |
filepath |
str
|
The file path to the paper being processed. |
vector_store |
str
|
The vector store to use. |
loader |
str
|
The data loader to ingest the paper with. |
mode |
str
|
The run mode. |
similarity_top_k |
int
|
The base integer used to calculate the similarity_top_k and top_n values. |
chunking_config |
str
|
The chunking configuration to use during node parsing. |
git_data |
Optional[GitData]
|
The optional github repository information to include in the documents. |
other_docs |
Optional[list[str]]
|
The file path to any additional documentation to include in the documents. |
Source code in bcorag/custom_types/core_types.py
SourceNode
Bases: TypedDict
Holds the source node information for one node.
Attributes:
Name | Type | Description |
---|---|---|
node_id |
str
|
|
content |
str
|
|
metdata |
str
|
|
score |
str
|
|
Source code in bcorag/custom_types/core_types.py
DomainContent
Bases: TypedDict
Holds the most recent generated domain for in memory storage.
Attributes:
Name | Type | Description |
---|---|---|
usability |
Optional[str]
|
|
io |
Optional[str]
|
|
description |
Optional[str]
|
|
execution |
Optional[str]
|
|
parametric |
Optional[str]
|
|
error |
Optional[list[str]]
|
|
Source code in bcorag/custom_types/core_types.py
IndividualDomainMapEntry
Bases: TypedDict
Information for one domain to prompt and process the user domain choice.
Attributes:
Name | Type | Description |
---|---|---|
retrieval_prompt |
str
|
The prompt to use for the RAG pipeline retrieval process. |
llm_prompt |
str
|
The prompt to use for the LLM. |
top_level |
bool
|
Whether the specified domain includes object's defined in the top level JSON schema. |
user_prompt |
str
|
The prompt string to display to the user. |
code |
str
|
The short hand code for choosing the domain. |
dependencies |
list[DomainKey]
|
The domain dependencies. |
Source code in bcorag/custom_types/core_types.py
DomainMap
Bases: TypedDict
Domain map for processing user input. Maps the user input for the domain prompt to the prompt to use for querying the RAG pipeline.
Attributes:
Name | Type | Description |
---|---|---|
usability |
IndividualDomainMapEntry
|
|
io |
IndividualDomainMapEntry
|
|
description |
IndividualDomainMapEntry
|
|
execution |
IndividualDomainMapEntry
|
|
parametric |
IndividualDomainMapEntry
|
|
error |
IndividualDomainMapEntry
|
|
Source code in bcorag/custom_types/core_types.py
OptionSchema
Bases: TypedDict
Schema for a config object option entry in the config JSON file.
Attributes:
Name | Type | Description |
---|---|---|
list |
list[str]
|
The list of options to choose from. |
default |
str
|
The option to use as the default. |
documentation |
str
|
The link to the documentation for the option. |
Source code in bcorag/custom_types/core_types.py
ConfigObjectOptions
Bases: TypedDict
Schema for the supported options.
Attributes:
Name | Type | Description |
---|---|---|
loader |
OptionSchema
|
|
chunking_config |
OptionSchema
|
|
embedding_model |
OptionSchema
|
|
vector_store |
OptionSchema
|
|
similarity_top_k |
OptionSchema
|
|
llm |
OptionSchema
|
|
mode |
OptionSchema
|
|
Source code in bcorag/custom_types/core_types.py
ConfigObject
Bases: TypedDict
Config JSON schema.
Attributes:
Name | Type | Description |
---|---|---|
paper_directory |
str
|
The file path to the paper's directory. |
options |
ConfigObjectOptions
|
The supported configuration options. |
Source code in bcorag/custom_types/core_types.py
create_git_filters(filter_type, filter, value)
Constructor for the GitFilters
TypedDict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_type |
FilterType
|
The type of github filter (whether it is an include or exclude filter). |
required |
filter |
GitFilter
|
The filter enum specification. |
required |
value |
list[str]
|
The values to filter on. |
required |
Returns:
Type | Description |
---|---|
GitFilters
|
|
Source code in bcorag/custom_types/core_types.py
create_git_data(user, repo, branch, filters=[])
Constructor for the GitData
TypedDict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user |
str
|
The github repo owner. |
required |
repo |
str
|
The repo name. |
required |
branch |
str
|
The repo branch to index. |
required |
filters |
list[GitFilters]
|
The list of filters to apply. |
[]
|
Returns:
Type | Description |
---|---|
GitData
|
|
Source code in bcorag/custom_types/core_types.py
create_user_selections(llm, embedding_model, filename, filepath, vector_store, loader, mode, similarity_top_k, chunking_config, git_data, other_docs)
Constructor for the UserSelections
TypedDict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
llm |
str
|
The LLM to use. |
required |
embedding_model |
str
|
The embedding model to use. |
required |
filename |
str
|
The file name of the paper being processed. |
required |
filepath |
str
|
The file path to the paper being processed. |
required |
vector_store |
str
|
The vector store to use. |
required |
loader |
str
|
The data loader to ingest the paper with. |
required |
mode |
str
|
The run mode. |
required |
similarity_top_k |
int
|
The base integer used to calculate the similarity_top_k and top_n values. |
required |
chunking_config |
str
|
The chunking configuration to use during node parsing. |
required |
git_data |
Optional[GitData]
|
The optional github repository information to include in the documents. |
required |
other_docs |
Optional[list[str]]
|
The file path to any additional documentation to include in the documents. |
required |
Returns:
Type | Description |
---|---|
UserSelections
|
|
Source code in bcorag/custom_types/core_types.py
default_domain_content()
Creates an empty, default DomainContent TypedDict.
Returns:
Type | Description |
---|---|
DomainContent
|
|
Source code in bcorag/custom_types/core_types.py
add_source_nodes(domain_content, nodes)
Adds source node data to the domain content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
domain_content |
DomainContent
|
The domain content instance to add source node data to. |
required |
nodes |
list[NodeWithScore]
|
List of nodes with score data. |
required |
Returns:
Type | Description |
---|---|
DomainContent
|
The updated domain content object. |