Tony20100/langchain_full huggingface dataset:
DictStrAny
classmethod from_orm(obj: Any) → Model¶
Parameters
obj (Any) – 
Return type
Model
get_files_from_directory(directory_path: str) → str[source]¶
Recursively fetches files from a directory in the repo.
Parameters
directory_path (str) – Path to the directory
Returns
List of file paths, or an error message.
Return type
str
get_issue(issue_number: int) → Dict[str, Any][source]¶
Fetches a specific issue and its first 10 comments
:param issue_number: The number for the github issue
:type issue_number: int
Returns
A dictionary containing the issue’s title,
body, comments as a string, and the username of the user
who opened the issue
Return type
dict
Parameters
issue_number (int) – 
get_issues() → str[source]¶
Fetches all open issues from the repo excluding pull requests
Returns
A plaintext report containing the number of issues
and each issue’s title and number.
Return type
str
get_pull_request(pr_number: int) → Dict[str, Any][source]¶
Fetches a specific pull request and its first 10 comments,
limited by max_tokens.
Parameters
pr_number (int) – The number for the Github pull
max_tokens (int) – The maximum number of tokens in the response
Returns
A dictionary containing the pull’s title, body,
and comments as a string
Return type
dict
and comments as a string
Return type
dict
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
by_alias (bool) – 
skip_defaults (Optional[bool]) – 
exclude_unset (bool) – 
exclude_defaults (bool) – 
exclude_none (bool) – 
encoder (Optional[Callable[[Any], Any]]) – 
models_as_dict (bool) – 
dumps_kwargs (Any) – 
Return type
unicode
list_branches_in_repo() → str[source]¶
Fetches a list of all branches in the repository.
Returns
A plaintext report containing the names of the branches.
Return type
str
list_files_in_bot_branch() → str[source]¶
Fetches all files in the active branch of the repo,
the branch the bot uses to make changes.
Returns
A plaintext list containing the filepaths in the branch.
Return type
str
list_files_in_main_branch() → str[source]¶
Fetches all files in the main branch of the repo.
Fetches all files in the main branch of the repo.
Returns
A plaintext report containing the paths and names of the files.
Return type
str
list_open_pull_requests() → str[source]¶
Fetches all open PRs from the repo
Returns
A plaintext report containing the number of PRs
and each PR’s title and number.
Return type
str
list_pull_request_files(pr_number: int) → List[Dict[str, Any]][source]¶
Fetches the full text of all files in a PR. Truncates after first 3k tokens.
# TODO: Enhancement to summarize files with ctags if they’re getting long.
Parameters
pr_number (int) – The number of the pull request on Github
Returns
A dictionary containing the issue’s title,
body, and comments as a string
Return type
dict
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
path (Union[str, Path]) – 
content_type (unicode) – 
encoding (unicode) – 
proto (Protocol) – 
allow_pickle (bool) – 
Return type
Model
parse_issues(issues: List[Issue]) → List[dict][source]¶
Extracts title and number from each Issue and puts them in a dictionary
:param issues: A list of Github Issue objects
:type issues: List[Issue]
Returns
A dictionary of issue titles and numbers
Return type
List[dict]
Parameters
issues (List[Issue]) – 
classmethod parse_obj(obj: Any) → Model¶
Parameters
obj (Any) – 
Return type
Model
parse_pull_requests(pull_requests: List[PullRequest]) → List[dict][source]¶
Extracts title and number from each Issue and puts them in a dictionary
:param issues: A list of Github Issue objects
:type issues: List[Issue]
Returns
A dictionary of issue titles and numbers
Return type
List[dict]
Parameters
pull_requests (List[PullRequest]) – 
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
b (Union[str, bytes]) – 
content_type (unicode) – 
encoding (unicode) – 
proto (Protocol) – 
allow_pickle (bool) – 
Return type
Model
read_file(file_path: str) → str[source]¶
Read a file from this agent’s branch, defined by self.active_branch,
which supports PR branches.
:param file_path: the file path
:type file_path: str
Returns
The file decoded as a string, or an error message if not found
Return type
str
Parameters
file_path (str) – 
run(mode: str, query: str) → str[source]¶
Parameters
mode (str) – 
query (str) – 
Return type
str
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
Parameters
by_alias (bool) – 
ref_template (unicode) – 
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) – 
ref_template (unicode) – 
dumps_kwargs (Any) – 
Return type
unicode
search_code(query: str) → str[source]¶
Return type
unicode
search_code(query: str) → str[source]¶
Searches code in the repository.
# Todo: limit total tokens returned…
Parameters
query (str) – The search query
Returns
A string containing, at most, the top 5 search results
Return type
str
search_issues_and_prs(query: str) → str[source]¶
Searches issues and pull requests in the repository.
Parameters
query (str) – The search query
Returns
A string containing the first 5 issues and pull requests
Return type
str
set_active_branch(branch_name: str) → str[source]¶
Equivalent to git checkout branch_name for this Agent.
Clones formatting from Github.
Returns an Error (as a string) if branch doesn’t exist.
Parameters
branch_name (str) – 
Return type
str
update_file(file_query: str) → str[source]¶
Updates a file with new content.
:param file_query: Contains the file path and the file contents.
The old file contents is wrapped in OLD <<<< and >>>> OLD
The new file contents is wrapped in NEW <<<< and >>>> NEW
For example:
/test/hello.txt
OLD <<<<
Hello Earth!
>>>> OLD
NEW <<<<
Hello Mars!
>>>> NEW
Returns
A success or failure message
Parameters
file_query (str) – 
Return type
str
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
Parameters
localns (Any) – 
Return type
None
classmethod validate(value: Any) → Model¶
Parameters
value (Any) – 
Return type
Model
Examples using GitHubAPIWrapper¶
Github
langchain_community.utilities.clickup.load_query¶
langchain_community.utilities.clickup.load_query(query: str, fault_tolerant: bool = False) → Tuple[Optional[Dict], Optional[str]][source]¶
Parse a JSON string and return the parsed object.
If parsing fails, returns an error message.
Parameters
query (str) – The JSON string to parse.
fault_tolerant (bool) – 
Returns
A tuple containing the parsed object or None and an error message or None.
Return type
Tuple[Optional[Dict], Optional[str]]
Exceptions:json.JSONDecodeError: If the input is not a valid JSON string.
langchain_community.utilities.opaqueprompts.desanitize¶
langchain_community.utilities.opaqueprompts.desanitize(sanitized_text: str, secure_context: bytes) → str[source]¶
Restore the original sensitive data from the sanitized text.
Parameters
sanitized_text (str) – Sanitized text.
secure_context (bytes) – Secure context returned by the sanitize function.
Returns
De-sanitized text.
Return type
str
langchain_community.utilities.pebblo.Framework¶
class langchain_community.utilities.pebblo.Framework[source]¶
Bases: BaseModel
Pebblo Framework instance.
Parameters
name (str) – Name of the Framework.
version (str) – Version of the Framework.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param name: str [Required]¶
param version: str [Required]¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
langchain_community.utilities.mojeek_search.MojeekSearchAPIWrapper¶
class langchain_community.utilities.mojeek_search.MojeekSearchAPIWrapper[source]¶
Bases: BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param api_key: str [Required]¶
param search_kwargs: dict [Optional]¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
deep (bool) – set to True to make a deep copy of the model
self (Model) – 
Returns
new model instance
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
by_alias (bool) – 
skip_defaults (Optional[bool]) – 
exclude_unset (bool) – 
exclude_defaults (bool) – 
exclude_none (bool) – 
encoder (Optional[Callable[[Any], Any]]) – 
models_as_dict (bool) – 
dumps_kwargs (Any) – 
Return type
unicode
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
path (Union[str, Path]) – 
content_type (unicode) – 
encoding (unicode) – 
proto (Protocol) – 
allow_pickle (bool) – 
Return type
Model
classmethod parse_obj(obj: Any) → Model¶
Parameters
obj (Any) – 
Return type
Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
b (Union[str, bytes]) – 
content_type (unicode) – 
encoding (unicode) – 
proto (Protocol) – 
allow_pickle (bool) – 
Return type
Model
run(query: str) → str[source]¶
Parameters
query (str) – 
Return type
str
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
Parameters
by_alias (bool) – 
ref_template (unicode) – 
Return type
DictStrAny
langchain_community.utilities.reddit_search.RedditSearchAPIWrapper¶
class langchain_community.utilities.reddit_search.RedditSearchAPIWrapper[source]¶
Bases: BaseModel
Wrapper for Reddit API
To use, set the environment variables REDDIT_CLIENT_ID,
REDDIT_CLIENT_SECRET, REDDIT_USER_AGENT to set the client ID,
client secret, and user agent, respectively, as given by Reddit’s API.
Alternatively, all three can be supplied as named parameters in the
constructor: reddit_client_id, reddit_client_secret, and
reddit_user_agent, respectively.
Example
from langchain_community.utilities import RedditSearchAPIWrapper
reddit_search = RedditSearchAPIWrapper()
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param reddit_client: Any = None¶
param reddit_client_id: Optional[str] = None¶
param reddit_client_secret: Optional[str] = None¶
param reddit_user_agent: Optional[str] = None¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
Parameters
obj (Any) – 
Return type
Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
b (Union[str, bytes]) – 
content_type (unicode) – 
encoding (unicode) – 
proto (Protocol) – 
allow_pickle (bool) – 
Return type
Model
results(query: str, sort: str, time_filter: str, subreddit: str, limit: int) → List[Dict][source]¶
Use praw to search Reddit and return a list of dictionaries,
one for each post.
Parameters
query (str) – 
sort (str) – 
time_filter (str) – 
subreddit (str) – 
limit (int) – 
Return type
List[Dict]
run(query: str, sort: str, time_filter: str, subreddit: str, limit: int) → str[source]¶
Search Reddit and return posts as a single string.
Parameters
query (str) – 
sort (str) – 
time_filter (str) – 
subreddit (str) – 
limit (int) – 
Return type
str
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
Parameters
by_alias (bool) – 
ref_template (unicode) – 
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) – 
ref_template (unicode) – 
dumps_kwargs (Any) – 
Return type
ref_template (unicode) – 
dumps_kwargs (Any) – 
Return type
unicode
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
Parameters
localns (Any) – 
Return type
None
classmethod validate(value: Any) → Model¶
Parameters
value (Any) – 
Return type
Model
Examples using RedditSearchAPIWrapper¶
Reddit Search
langchain_experimental.cpal.models.StoryModel¶
class langchain_experimental.cpal.models.StoryModel[source]¶
Bases: BaseModel
Story data.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param causal_operations: Any = None¶
param intervention: Any = None¶
param query: Any = None¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
deep (bool) – set to True to make a deep copy of the model
self (Model) – 
Returns
new model instance
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
by_alias (bool) – 
skip_defaults (Optional[bool]) – 
exclude_unset (bool) – 
exclude_defaults (bool) – 
exclude_none (bool) – 
encoder (Optional[Callable[[Any], Any]]) – 
models_as_dict (bool) – 
dumps_kwargs (Any) – 
Return type
unicode
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
path (Union[str, Path]) – 
content_type (unicode) – 
encoding (unicode) – 
proto (Protocol) – 
allow_pickle (bool) – 
Return type
Model
classmethod parse_obj(obj: Any) → Model¶
Parameters
obj (Any) – 
Return type
Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
b (Union[str, bytes]) – 
content_type (unicode) – 
encoding (unicode) – 
proto (Protocol) – 
allow_pickle (bool) – 
Return type
Model
print_debug_report() → None[source]¶
Return type
None
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
Parameters
by_alias (bool) – 
ref_template (unicode) – 
Return type
DictStrAny
langchain_experimental.cpal.models.EntityModel¶
class langchain_experimental.cpal.models.EntityModel[source]¶
Bases: BaseModel
Entity in the story.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param code: str [Required]¶
entity actions
param depends_on: List[str] = []¶
ancestor entities
param name: str [Required]¶
entity name
param value: float [Required]¶
entity initial value
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
langchain_experimental.cpal.models.NarrativeModel¶
class langchain_experimental.cpal.models.NarrativeModel[source]¶
Bases: BaseModel
Narrative input as three story elements.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param story_hypothetical: str [Required]¶
param story_outcome_question: str [Required]¶
param story_plot: str [Required]¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
langchain_experimental.cpal.base.CPALChain¶
class langchain_experimental.cpal.base.CPALChain[source]¶
Bases: _BaseStoryElementChain
Causal program-aided language (CPAL) chain implementation.
Security note: The building blocks of this class include the implementationof an AI technique that generates SQL code. If those SQL commands
are executed, it’s critical to ensure they use credentials that
are narrowly-scoped to only include the permissions this chain needs.
Failure to do so may result in data corruption or loss, since this chain may
attempt commands like DROP TABLE or INSERT if appropriately prompted.
The best way to guard against such negative outcomes is to (as appropriate)
limit the permissions granted to the credentials used with this chain.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param callback_manager: Optional[BaseCallbackManager] = None¶
[DEPRECATED] Use callbacks instead.
param callbacks: Callbacks = None¶
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param causal_chain: Optional[CausalChain] = None¶
param chain: LLMChain [Required]¶
param intervention_chain: Optional[InterventionChain] = None¶
param llm: BaseLanguageModel [Required]¶
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes