Using langchain to interview myself about my skills

Premise Ok, got this half baked idea , combine my #brag-document with the available [[langchain]] QA chains into a proof of concept maybe I can call [[langchain interview me 2023-feb]] So I’m going to throw a bunch of my source material together, language based, accessible as plain text doc, and then I will run the Link examples that provide references, citations, Ok, so for accumulating my information, import yaml import tempfile from pathlib import Path from datetime import datetime import pytz def utc_now(): return datetime.utcnow().replace(tzinfo=pytz.UTC) def utc_ts(dt): return dt.strftime("%Y-%m-%dT%H%M%S") def read_yaml(loc): with open(loc) as fd: return yaml.safe_load(fd) from pathlib import Path import os repos_dir = Path(os.getenv("REPOS_DIR")) assert repos_dir.is_dir() experience_loc = repos_dir / "my-challenges-and-accomplishments/experience.yaml" experiences_dict = read_yaml(experience_loc)["Descriptions"] sections = [] for project, detail in experiences_dict.items(): section = "" if detail.get("company"): company = detail.get("company") section = (f"When I worked at {company}, " f"there was a project in {detail['year']}, {project}.") elif detail.get("project"): project = detail.get("project") section = f"In {detail['year']}, I had a side project, {project}. " section += ". ".join([x for x in detail.get("one-liners", [])]) section += ". ".join([x for x in detail.get("stories", [])]) sections.append(section) workdir = repos_dir / "2023-interview-me" path = workdir / f"{utc_ts(utc_now())}-the-story-blurb.txt" path.write_text("\n\n\n".join(sections)) Ok let me run now some of the basic question answer chains Use my environment from before, ...

February 18, 2023 · (updated February 26, 2023) · 5 min · 985 words · Michal Piekarczyk

Quick lang chain test drive

Okay let me try that lang chain demo 19:23 ok yea looking at https://beta.openai.com/account/api-keys I did not have an api key yet, so lets try that out. how can one use https://github.com/hwchase17/langchain for [[question-answer-task]] over documentation ? https://langchain.readthedocs.io/en/latest/use_cases/question_answering.html 19:33 wow really cool so https://langchain.readthedocs.io/en/latest/use_cases/question_answering.html#adding-in-sources this says this can provide the sources used in answering a question ! nice 19:37 ok so first per https://langchain.readthedocs.io/en/latest/getting_started/getting_started.html here, installing this stuff, creating a new environment on my laptop pip install langchain pip install openai pip install faiss-cpu # adding this here after the fact after getting below error 20:11 got one error, ValueError: Could not import faiss python package. Please it install it with `pip install faiss` or `pip install faiss-cpu` (depending on Python version). Ok let me query the [[New yorker]] #article I added . I recently read [[The American Beast New Yorker]] this article by [[person Jill Lepore]] about the #report that was commissioned about the #[[January 6th Insurrection]] . I used my #iphone #scan-to-text feature to pull in the first page and a half to a text file, article.txt to try this out . Let’s see how this works. ...

January 29, 2023 · (updated May 20, 2023) · 2 min · 389 words · Michal Piekarczyk