🌙 LUNA - Case Study
Collection
8 items • Updated
prompt stringlengths 131 11.8k | completion stringlengths 7 173 | api stringlengths 11 48 |
|---|---|---|
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.settings.configure(rm=colbertv2, lm=llama) | dspy.settings.configure |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_LongFormQA_Cache')
get_ipython().run_line_magic('cd', 'DSPy_LongFormQA_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_LongFormQA_Cache'
if not os.access('/conte... | dspy.settings.configure(rm=colbertv2_wiki17_abstracts) | dspy.settings.configure |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.Prediction(generated_tweet=generated_tweet, context=context) | dspy.Prediction |
import dspy
from dsp.utils import deduplicate
from dspy.datasets import HotPotQA
from dspy.predict.retry import Retry
from dspy.teleprompt import BootstrapFewShot, BootstrapFewShotWithRandomSearch
from dspy.evaluate.evaluate import Evaluate
from dspy.primitives.assertions import assert_transform_module, backtrack_hand... | dspy.settings.configure(lm=turbo, trace=[], temperature=0.7) | dspy.settings.configure |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.Predict(AssessTweet) | dspy.Predict |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
get_ipython().run_line_magic('pip', 'install datasets')
import datasets
ds = datasets.load_dataset("openai_humaneval")
ds['test'][0]
import dspy, dotenv, os
dotenv.load_dotenv(os.path.expanduser("~/.env")) # lo... | dspy.Predict("question -> answer") | dspy.Predict |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.InputField() | dspy.InputField |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.ChainOfThought("context, question -> answer") | dspy.ChainOfThought |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_QuizGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_QuizGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_QuizGen_Cache'
if not os.access('/content', os.W... | Evaluate(metric=metric, devset=devset, num_threads=1, display_progress=True, display_table=5) | dspy.evaluate.evaluate.Evaluate |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_QuizGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_QuizGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_QuizGen_Cache'
if not os.access('/content', os.W... | BootstrapFewShotWithRandomSearch(metric = overall_metric, max_bootstrapped_demos=2, num_candidate_programs=6) | dspy.teleprompt.BootstrapFewShotWithRandomSearch |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.InputField() | dspy.InputField |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | Evaluate(devset=devset, num_threads=1, display_progress=True, display_table=5) | dspy.evaluate.evaluate.Evaluate |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_LongFormQA_Cache')
get_ipython().run_line_magic('cd', 'DSPy_LongFormQA_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_LongFormQA_Cache'
if not os.access('/conte... | BootstrapFewShotWithRandomSearch(metric = answer_correctness, max_bootstrapped_demos=2, num_candidate_programs=6) | dspy.teleprompt.BootstrapFewShotWithRandomSearch |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.Retrieve(k=num_passages) | dspy.Retrieve |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.Prediction(generated_tweet=generated_tweet, context=context) | dspy.Prediction |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | Evaluate(metric=metric, devset=devset, num_threads=1, display_progress=True, display_table=5) | dspy.evaluate.evaluate.Evaluate |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | BootstrapFewShotWithRandomSearch(metric=metric_EM, max_bootstrapped_demos=2, num_candidate_programs=8, num_threads=NUM_THREADS) | dspy.teleprompt.BootstrapFewShotWithRandomSearch |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.OpenAI(model='gpt-3.5-turbo', max_tokens=500) | dspy.OpenAI |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.InputField(desc="may contain relevant facts") | dspy.InputField |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_QuizGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_QuizGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_QuizGen_Cache'
if not os.access('/content', os.W... | Evaluate(metric=metric, devset=devset[38:39], num_threads=1, display_progress=True, display_table=5) | dspy.evaluate.evaluate.Evaluate |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.ChainOfThought('question -> answer') | dspy.ChainOfThought |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_QuizGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_QuizGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_QuizGen_Cache'
if not os.access('/content', os.W... | dspy.ColBERTv2(url='http://20.102.90.50:2017/wiki17_abstracts') | dspy.ColBERTv2 |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | BootstrapFewShot(metric=validate_context_and_answer) | dspy.teleprompt.BootstrapFewShot |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | BootstrapFewShotWithRandomSearch(metric = overall_metric, max_bootstrapped_demos=2, num_candidate_programs=6) | dspy.teleprompt.BootstrapFewShotWithRandomSearch |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.OutputField() | dspy.OutputField |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_QuizGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_QuizGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_QuizGen_Cache'
if not os.access('/content', os.W... | dspy.Predict(AssessQuizChoices) | dspy.Predict |
get_ipython().system('pip install clarifai')
get_ipython().system('pip install dspy-ai')
import dspy
from dspy.retrieve.clarifai_rm import ClarifaiRM
MODEL_URL = "https://clarifai.com/meta/Llama-2/models/llama2-70b-chat"
PAT = "CLARIFAI_PAT"
USER_ID = "YOUR_ID"
APP_ID = "YOUR_APP"
from langchain.text_spli... | dspy.settings.configure(lm=llm, rm=retriever_model) | dspy.settings.configure |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_LongFormQA_Cache')
get_ipython().run_line_magic('cd', 'DSPy_LongFormQA_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_LongFormQA_Cache'
if not os.access('/conte... | BootstrapFewShotWithRandomSearch(metric = answer_correctness, max_bootstrapped_demos=2, num_candidate_programs=6) | dspy.teleprompt.BootstrapFewShotWithRandomSearch |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_TweetGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_TweetGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_TweetGen_Cache'
if not os.access('/content', o... | dspy.InputField(desc="may contain relevant facts") | dspy.InputField |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | BootstrapFewShot(metric=validate_context_and_answer_and_hops) | dspy.teleprompt.BootstrapFewShot |
get_ipython().system('pip install clarifai')
get_ipython().system('pip install dspy-ai')
import dspy
from dspy.retrieve.clarifai_rm import ClarifaiRM
MODEL_URL = "https://clarifai.com/meta/Llama-2/models/llama2-70b-chat"
PAT = "CLARIFAI_PAT"
USER_ID = "YOUR_ID"
APP_ID = "YOUR_APP"
from langchain.text_spli... | dspy.Clarifai(model="https://clarifai.com/gcp/generate/models/gemini-pro", api_key=PAT, n=2) | dspy.Clarifai |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import dspy
from dspy.evaluate import Evaluate
from dspy.datasets.hotpotqa import HotPotQA
from dspy.teleprompt import BootstrapFewShotWithRandomSearch, BootstrapFinetune
ports = [7140, 7141, 7142, 7143, 7144, 71... | dspy.ChainOfThought("context, question -> answer") | dspy.ChainOfThought |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.Prediction(context=context, answer=prediction.answer) | dspy.Prediction |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.ChainOfThought(BasicQA) | dspy.ChainOfThought |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.evaluate.answer_exact_match(example, pred) | dspy.evaluate.answer_exact_match |
import openai
import dspy
import json
with open("creds.json", "r") as creds:
api_key = json.loads(creds.read())["openai_key"]
lm = dspy.OpenAI(model='gpt-4', api_key=api_key, model_type='chat', max_tokens = 500)
dspy.settings.configure(lm=lm)
from dspy.datasets import HotPotQA
dataset = HotPotQA(train_seed=1... | KNNFewShot(KNN, 7, trainset) | dspy.teleprompt.KNNFewShot |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_QuizGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_QuizGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_QuizGen_Cache'
if not os.access('/content', os.W... | BootstrapFewShotWithRandomSearch(metric = overall_metric, max_bootstrapped_demos=2, num_candidate_programs=6) | dspy.teleprompt.BootstrapFewShotWithRandomSearch |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.ColBERTv2(url='http://20.102.90.50:2017/wiki17_abstracts') | dspy.ColBERTv2 |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_LongFormQA_Cache')
get_ipython().run_line_magic('cd', 'DSPy_LongFormQA_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_LongFormQA_Cache'
if not os.access('/conte... | dspy.OutputField(desc="boolean indicating if text is faithful to context") | dspy.OutputField |
import glob
import os
import pandas as pd
import random
import dspy
from dspy.evaluate import Evaluate
from dspy.teleprompt import BootstrapFewShotWithRandomSearch
os.environ["DSP_NOTEBOOK_CACHEDIR"] = os.path.join('.', 'cache')
turbo = dspy.OpenAI(model='gpt-3.5-turbo-1106', max_tokens=250, model_type='chat')
d... | dspy.OutputField(desc="Yes or No") | dspy.OutputField |
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
import sys
import os
try: # When on google Colab, let's clone the notebook so we download the cache.
import google.colab
repo_path = 'dspy'
get_ipython().system('git -C $repo_path pull origin || git clon... | dspy.InputField() | dspy.InputField |
get_ipython().system('git clone https://huggingface.co/arnavs11/DSPy_QuizGen_Cache')
get_ipython().run_line_magic('cd', 'DSPy_QuizGen_Cache/')
get_ipython().system('git checkout master')
get_ipython().run_line_magic('cd', '..')
import os
repo_clone_path = '/content/DSPy_QuizGen_Cache'
if not os.access('/content', os.W... | dspy.settings.configure(rm=colbertv2_wiki17_abstracts) | dspy.settings.configure |