This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dspy | |
import os | |
from dotenv import load_dotenv | |
load_dotenv() | |
llm = dspy.OpenAI( | |
model='gpt-4', | |
api_key=os.environ['OPENAI_API_KEY'], | |
max_tokens=100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Testing file upload | |
echo "Testing file upload..." | |
curl -X 'POST' \ | |
'http://localhost:8000/uploadfile/' \ | |
-H 'accept: application/json' \ | |
-H 'Content-Type: multipart/form-data' \ | |
-F 'file=@/usercode/test-file.txt;type=text/plain' | |
echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import (FastAPI, UploadFile, | |
HTTPException, Depends, BackgroundTasks) | |
import os | |
import shutil | |
import io | |
from db import get_db, File, FileChunk | |
from sqlalchemy.orm import Session | |
from file_parser import FileParser | |
from background_tasks import TextProcessor, client | |
from sqlalchemy import select |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import OpenAI | |
from dotenv import load_dotenv | |
load_dotenv() | |
class GPT3DFA: | |
def __init__(self, topic): | |
self.current_state = 'start' | |
self.client = OpenAI() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DFA: | |
def __init__(self): | |
self.states = ['q0', 'q1'] | |
self.alphabet = ['0', '1'] | |
self.transition_function = { | |
('q0', '0'): 'q1', | |
('q0', '1'): 'q0', | |
('q1', '0'): 'q0', | |
('q1', '1'): 'q1', | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can you provide the difference between strategy and planning in corporate setting. Get insights from researchers like Michael Porter and Michael D Watkins. Also tell me more about Strategic Planning. | |
ChatGPT | |
In a corporate setting, strategy and planning, though closely related, serve distinct roles in guiding an organization toward its objectives. | |
Strategy refers to the overarching direction and scope of an organization over the long term, designed to achieve competitive advantage and meet the needs of markets and stakeholders. It's about choosing the unique position the company aims to occupy in its competitive landscape, determining how resources should be allocated to pursue this direction, and setting the framework for making decisions. Michael Porter, a prominent figure in the field of competitive strategy, emphasizes the importance of strategy in defining and communicating an organization's unique position, differentiating it from competitors, and carving out a niche within its industry. Porter's idea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hey, can you please give me the difference between strategy and planning ? | |
ChatGPT | |
Certainly! Strategy and planning are two interconnected concepts often used in business, project management, and various other contexts, but they serve different purposes and operate at different levels. | |
Strategy | |
Definition: Strategy is a broad, overarching approach that defines how an organization or individual will achieve its goals or objectives. It is about setting long-term directions and making decisions on allocating resources to pursue this direction. | |
Focus: Strategy is concerned with what you want to achieve and why. It involves understanding the environment, including opportunities and threats, as well as strengths and weaknesses, to formulate a unique position that provides a competitive advantage. | |
Scope: Typically broad and high-level, strategy sets the vision and direction over a long time frame. It is more about the "big picture" and setting the stage for how to compete in the market or achieve long-term goals. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Number of games to play | |
n_games = 5 | |
# Initialize a dictionary to store the results | |
results = {"Agent wins": 0, "Stockfish wins": 0, "Draw": 0} | |
# Run the game n times | |
for i in range(n_games): | |
# print(f"Starting game {i+1}...") | |
result = play_game() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialize a chess board and the chess engine | |
engine = chess.engine.SimpleEngine.popen_uci("/opt/homebrew/Cellar/stockfish/16/bin/stockfish") | |
# Configure Stockfish to a specific skill level, e.g., 10 | |
engine.configure({"Skill Level": 0}) | |
with open('learning_chess.txt', 'r') as file: | |
past_game_performance = file.read() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from langchain_openai import ChatOpenAI | |
import chess | |
import chess.engine | |
from langchain_core.pydantic_v1 import BaseModel, Field | |
from dotenv import load_dotenv | |
load_dotenv() | |