Created
September 12, 2023 11:37
-
-
Save fsndzomga/3933c1c72ba46b2d93a5b62e4aefdf28 to your computer and use it in GitHub Desktop.
Data enrichment
This file contains hidden or 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
llm = ChatOpenAI(max_tokens=200) | |
newsgroups_train_enriched = [] | |
data = newsgroups_train.data | |
for index in range(len(data)): | |
# ... (Data preprocessing) | |
messages = [ | |
SystemMessage(content="You are a helpful assistant that classifies texts."), | |
HumanMessage(content=f"Give one category to the following text: {text}. The category should be among this list: {categories}") | |
] | |
response = llm(messages) | |
newsgroups_train_enriched.append(text + response.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment