Skip to content

Commit

Permalink
Merge pull request #189 from eye-on-surveillance/main
Browse files Browse the repository at this point in the history
release: v0.0.2
  • Loading branch information
marvinmarnold authored Dec 14, 2023
2 parents 565d006 + 0d9d505 commit 45c7572
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 18 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Work in Progress

## Tulane Dev Integration Branch

Sawt is a tool designed to bridge the communication gap between New Orleanians and their city council representatives.

## Prerequisites

- Install [DVC](https://dvc.org/doc/install)
Expand Down
20 changes: 18 additions & 2 deletions packages/googlecloud/functions/getanswer/inquirer.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ def get_indepth_response_from_query(df, db, query, k):

docs_page_content = append_metadata_to_content(doc_list)


template = """
Question: {question}
Based on the information from the New Orleans city council documents provided, answer the following question: {question}.
If possible, extract the key points, decisions, and actions discussed during the city council meetings relevant to {question};
highlight any immediate shortcomings, mistakes, or negative actions by the city council relevant to {question};
elaborate on the implications and broader societal or community impacts of the identified issues relevant to {question};
Expand All @@ -190,9 +190,25 @@ def get_indepth_response_from_query(df, db, query, k):
The final output should be in paragraph form without any formatting, such as prefixing your points with "a.", "b.", or "c."
The final output should not include any reference to the model's active sorting by date.
Please provide direct and concise responses without unnecessary verbosity.
If your response includes technical or uncommon terms related to city council that may not be widely understood, kindly provide a brief definition for those terms at the end of your response using the following format:
Definitions:
[Word]
[Definition]
[Word]
[Definition]
The final output should be in paragraph form without any formatting, such as prefixing your points with "a.", "b.", or "c."
The final output should not include any reference to the model's active sorting by date.
Documents: {docs}
"""


prompt = PromptTemplate(
input_variables=["question", "docs"],
template=template,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def make_api_call(title, k_inp):
response = requests.post(f"{api_endpoint}", json=payload)
rdict = json.loads(response.text)
card_type_out = rdict["card_type"]
citations_out = rdict["citations"]
responses_out = rdict["responses"]
citations_out = json.dumps(eval(str(rdict["citations"])))
responses_out = json.dumps(eval(str(rdict["responses"])))
return card_type_out, citations_out, responses_out, k_inp

# Open CSV file in append mode
Expand Down
1 change: 1 addition & 0 deletions packages/web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ NEXT_PUBLIC_SUPABASE_URL=https://xxxxxxxxxxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
NEXT_PUBLIC_TGI_API_ENDPOINT=http://localhost:8080
SUPABASE_SERVICE_ROLE_SECRET=""
NEXT_PUBLIC_FEEDBACK_VERSION=v0.0.2
25 changes: 15 additions & 10 deletions packages/web/app/feedback/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ export default function UserFeedback() {
// };

const randQuestionId = () => {
return Math.floor(Math.random() * 291);
return Math.floor(Math.random() * 237);
};

const shuffleArray = (array: Number[]) => {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
};
// const shuffleArray = (array: Number[]) => {
// for (let i = array.length - 1; i > 0; i--) {
// const j = Math.floor(Math.random() * (i + 1));
// [array[i], array[j]] = [array[j], array[i]];
// }
// return array;
// };

// const shuffledQuestionIds = shuffleArray(question_idArray);
const [currentIndex, setCurrentIndex] = useState<number>(0);
Expand All @@ -69,13 +69,14 @@ export default function UserFeedback() {
useEffect(() => {
const getCard = async () => {
const randId = randQuestionId();
console.log("Fetching cards " + randId);
// console.log("Fetching cards " + randId);
try {
const cardsArray: Array<Array<ICard>> = [];
const { data: newCards, error } = await supabase
.from(TABLES.FEEDBACK_CARDS)
.select("*")
.eq("question_id", randId);
.eq("question_id", randId)
.eq("model_version", process.env.NEXT_PUBLIC_FEEDBACK_VERSION);
if (newCards) {
setCards(newCards);
}
Expand Down Expand Up @@ -154,6 +155,10 @@ export default function UserFeedback() {
Next question
</button>
)}

<p className="mt-6 text-right text-xs">
{process.env.NEXT_PUBLIC_FEEDBACK_VERSION}
</p>
</div>
<div className="md:grow"></div>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/web/components/NewQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default function NewQuery() {
if (newCard) {
await sendQueryToFunction(newCard);
setCurrentCardId(newCard.id ?? null);
setQuery('');
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alter table "public"."feedback_cards" add column "model_version" text;

update feedback_cards
set
model_version = 'v0.0.1';

alter table "public"."feedback_cards" alter column "model_version" set not null;

1 comment on commit 45c7572

@vercel
Copy link

@vercel vercel bot commented on 45c7572 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.