Skip to content

Instantly share code, notes, and snippets.

View fsndzomga's full-sized avatar

Franck Stéphane Ndzomga fsndzomga

View GitHub Profile
from pydantic import BaseModel
from anonLLM.llm import OpenaiLanguageModel
from dotenv import load_dotenv
load_dotenv()
llm = OpenaiLanguageModel(anonymize=False, temperature=1)
class Person(BaseModel):
from langchain_openai import ChatOpenAI
from langchain_core.pydantic_v1 import BaseModel, Field
from dotenv import load_dotenv
load_dotenv()
class NextMove(BaseModel):
move: str = Field(..., description="Best next move to win the chess game. It should be in Standard Algebraic Notation")
import dspy
from dspy.functional import TypedPredictor
from pydantic import BaseModel, Field
from typing import List
from dotenv import load_dotenv
class Task(BaseModel):
"Class for keeping track of a task"
name: str = Field(..., description="name of the task")
import requests
from bs4 import BeautifulSoup
from dotenv import load_dotenv
import os
load_dotenv()
BASE_URL = 'https://news.ycombinator.com'
USERNAME = os.getenv("USERNAME")
PASSWORD = os.getenv("PASSWORD")
import streamlit as st
from st_chat_message import message
from dotenv import load_dotenv
import fitz
load_dotenv()
from raptor.raptor import RetrievalAugmentation # noqa
RA = RetrievalAugmentation()
response = openai.ChatCompletion.create(
model=fine_tuned_model_id, messages=test_messages, temperature=0.5
)
print(response["choices"][0]["message"]["content"])
training_response = openai.File.create(
file=open(training_file_name, "rb"), purpose="fine-tune"
)
training_file_id = training_response["id"]
validation_response = openai.File.create(
file=open(validation_file_name, "rb"), purpose="fine-tune"
)
validation_file_id = validation_response["id"]
import json
# Load JSON data from mypoems.json
with open('mypoems.json', 'r') as json_file:
json_data = json.load(json_file)
# Conversion from JSON to JSONL
with open('mypoems.jsonl', 'w') as f:
for entry in json_data:
json_str = json.dumps(entry)
# The goal of this program is to transform the poems.txt file into a well structured json file
from dotenv import load_dotenv
import json
import re
from anonLLM.llm import OpenaiLanguageModel
load_dotenv()
SEP = '---'
import chess
import chess.engine
import os
import dspy
from pydantic import BaseModel, Field
from dspy.functional import TypedPredictor
from dotenv import load_dotenv
load_dotenv()