mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-05 09:25:14 +03:00
### Description renamed several repository links from `hwchase17` to `langchain-ai`. ### Why I discovered that the README file in the devcontainer contains an old repository name, so I took the opportunity to rename the old repository name in all files within the repository, excluding those that do not require changes. ### Dependencies none ### Tag maintainer @baskaryan ### Twitter handle [kzk_maeda](https://twitter.com/kzk_maeda)
7.1 KiB
7.1 KiB
In [ ]:
# If you haven't set your access token as an environment variable, pass it in here.
from getpass import getpass
ACCESS_TOKEN = getpass()In [10]:
from langchain.document_loaders import GitHubIssuesLoaderIn [11]:
loader = GitHubIssuesLoader(
repo="langchain-ai/langchain",
access_token=ACCESS_TOKEN, # delete/comment out this argument if you've set the access token as an env var.
creator="UmerHA",
)In [12]:
docs = loader.load()In [13]:
print(docs[0].page_content)
print(docs[0].metadata)# Creates GitHubLoader (#5257)
GitHubLoader is a DocumentLoader that loads issues and PRs from GitHub.
Fixes #5257
Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested:
DataLoaders
- @eyurtsev
{'url': 'https://github.com/langchain-ai/langchain/pull/5408', 'title': 'DocumentLoader for GitHub', 'creator': 'UmerHA', 'created_at': '2023-05-29T14:50:53Z', 'comments': 0, 'state': 'open', 'labels': ['enhancement', 'lgtm', 'doc loader'], 'assignee': None, 'milestone': None, 'locked': False, 'number': 5408, 'is_pull_request': True}
In [14]:
loader = GitHubIssuesLoader(
repo="langchain-ai/langchain",
access_token=ACCESS_TOKEN, # delete/comment out this argument if you've set the access token as an env var.
creator="UmerHA",
include_prs=False,
)
docs = loader.load()In [15]:
print(docs[0].page_content)
print(docs[0].metadata)### System Info
LangChain version = 0.0.167
Python version = 3.11.0
System = Windows 11 (using Jupyter)
### Who can help?
- @hwchase17
- @agola11
- @UmerHA (I have a fix ready, will submit a PR)
### Information
- [ ] The official example notebooks/scripts
- [X] My own modified scripts
### Related Components
- [X] LLMs/Chat Models
- [ ] Embedding Models
- [X] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async
### Reproduction
```
import os
os.environ["OPENAI_API_KEY"] = "..."
from langchain.chains import LLMChain
from langchain.chat_models import ChatOpenAI
from langchain.prompts import PromptTemplate
from langchain.prompts.chat import ChatPromptTemplate
from langchain.schema import messages_from_dict
role_strings = [
("system", "you are a bird expert"),
("human", "which bird has a point beak?")
]
prompt = ChatPromptTemplate.from_role_strings(role_strings)
chain = LLMChain(llm=ChatOpenAI(), prompt=prompt)
chain.run({})
```
### Expected behavior
Chain should run
{'url': 'https://github.com/langchain-ai/langchain/issues/5027', 'title': "ChatOpenAI models don't work with prompts created via ChatPromptTemplate.from_role_strings", 'creator': 'UmerHA', 'created_at': '2023-05-20T10:39:18Z', 'comments': 1, 'state': 'open', 'labels': [], 'assignee': None, 'milestone': None, 'locked': False, 'number': 5027, 'is_pull_request': False}
In [ ]: