Skip to content

Instantly share code, notes, and snippets.

View john-adeojo's full-sized avatar

John Adeojo john-adeojo

View GitHub Profile
Given the fields `question`, produce the fields `answer`.
---
Follow the following format.
Question: ${question}
Answer: ${answer}
---
@john-adeojo
john-adeojo / Llama2_7B_baseline_labeled_fewshot.txt
Last active October 24, 2023 09:53
Generated text from line 13
Given the fields `question`, produce the fields `answer`.
---
Follow the following format.
Question: ${question}
Answer: ${answer}
---
Given the fields `question`, produce the fields `answer`.
---
Follow the following format.
Question: ${question}
Answer: ${answer}
---
Given the fields `question`, produce the fields `answer`.
---
Follow the following format.
Question: ${question}
Answer: ${answer}
---
Solve a question answering task with interleaving Thought, Action, Observation steps. Thought can reason about the current
situation, and Action can be three types:
2 (1) Search[entity], which searches the exact entity on Wikipedia and returns the first paragraph if it exists. If not, it
will return some similar entities to search.
3 (2) Lookup[keyword], which returns the next sentence containing keyword in the current passage.
4 (3) Finish[answer], which returns the answer and finishes the task.
5 Here are some examples.
6 Question: What is the elevation range for the area that the eastern sector of the Colorado orogeny extends into?
7 Action 1: Search[Colorado orogeny]
8 Observation 1: The Colorado orogeny was an episode of mountain building (an orogeny) in Colorado and surrounding areas.
prompt = '''
Sentence 1: "The church choir sings to the masses as they sing joyous songs from the book at a church."
Sentence 2: "The church has cracks in the ceiling."
'''
context = '''
Task: For each pair of sentences below, determine the relationship between them. Label them as:
0 (entailment) if the second sentence is a logical outcome or directly inferred from the first.
1 (neutral) if the second sentence is neither entailed nor contradicted by the first; it's just additional information.
2 (contradiction) if the second sentence contradicts or opposes the information in the first.
Example 1:
Sentence 1: "The cat sat on the mat."
Sentence 2: "The mat has a cat on it."
def generate_response(prompt, context):
openai.api_key = API_KEY
content = "You are a text classification model"
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": content},
{"role": "user", "content": f"Context: {context}. {prompt}"}
from haystack import Pipeline
from function_call import OpenAIFunctionCall
def create_pipeline(retriever, API_KEY):
p = Pipeline()
p.add_node(component=retriever, name="retriever", inputs=["Query"])
p.add_node(component=OpenAIFunctionCall(API_KEY), name="OpenAIFunctionCall", inputs=["retriever"])
return p
import openai
from haystack.nodes.base import BaseComponent
from typing import List
import json
class OpenAIFunctionCall(BaseComponent):
outgoing_edges = 1
def __init__(self, API_KEY):
self.API_KEY = API_KEY