Upload 135 files
Browse files- 03e55622-8dd2-47c4-b487-ef1ab5be6cbe.png +3 -0
- 09897491-4e9e-4b64-9717-141abb56ee57.png +3 -0
- 159d6b20-9a4a-435d-a5ec-fce2430c9858.png +3 -0
- 178d1817-d4fc-4438-b953-57917efb1911.png +3 -0
- 193d636d-b9c7-4b71-bf57-d295632bd196.png +3 -0
- 1ebfd82b-4a08-4a4c-bdeb-6ac27530f13a.png +3 -0
- 1f32a984-6c18-4929-8d1b-ed3dc8137f2a.png +3 -0
- 2e7bae0e-1b98-45b8-b36d-996b2a6a9acc.png +3 -0
- 3f6784d1-83eb-4d3d-9547-3375af5496e8.png +3 -0
- 404e2ab5-6feb-4531-81f0-9ac6edd14064.png +3 -0
- 4179f593-03ac-4133-bfff-14033bf25e8f.png +3 -0
- 49cc0707-2203-4144-8ee3-2867c667494e.png +3 -0
- 4ff827e7-d5b1-4749-9679-f8d2f09e9d24.png +3 -0
- 541583a6-8d5a-4397-a68f-4b74c0d4f1c6.png +3 -0
- 5fd07b27-5a52-4bcb-bf3e-d9b7ddd1f2c4.png +3 -0
- 72bc8cba-1dfb-4566-ac36-917b9c07cd5d.png +3 -0
- 7d00590e-2988-4982-aa44-ff45dd4e085f.png +3 -0
- 83ac1ae7-90a4-423f-8bfd-cb50b646f299.png +3 -0
- 8d42c3f2-83fa-4989-9ebf-496008597f3d.png +3 -0
- 9025c65c-7c4c-4839-abca-98f317f92069.png +3 -0
- 98df1d72-2343-44c5-a674-d8f9e3ea2dfa.png +3 -0
- b2050341-7071-4c20-9555-56e16832109b.png +3 -0
- ba61b293-7757-4778-b884-0cde02b4534f.png +3 -0
- c83a9628-7a74-4105-95d5-e202dd96e2e7.png +3 -0
- ca33b991-977a-4b3d-9bae-5b8671c8e5c6.png +3 -0
- d874be25-1ac6-4b36-8272-cbb5428ab3e9.png +3 -0
- da235143-b2ad-489e-b9cd-530e9860b71a.png +3 -0
- f01d742d-efea-4df2-8598-da051f736459.png +3 -0
- f680fb72-0a41-414d-8aae-50faa01a4c02.png +3 -0
- metadata.jsonl +29 -0
03e55622-8dd2-47c4-b487-ef1ab5be6cbe.png
ADDED
Git LFS Details
|
09897491-4e9e-4b64-9717-141abb56ee57.png
ADDED
Git LFS Details
|
159d6b20-9a4a-435d-a5ec-fce2430c9858.png
ADDED
Git LFS Details
|
178d1817-d4fc-4438-b953-57917efb1911.png
ADDED
Git LFS Details
|
193d636d-b9c7-4b71-bf57-d295632bd196.png
ADDED
Git LFS Details
|
1ebfd82b-4a08-4a4c-bdeb-6ac27530f13a.png
ADDED
Git LFS Details
|
1f32a984-6c18-4929-8d1b-ed3dc8137f2a.png
ADDED
Git LFS Details
|
2e7bae0e-1b98-45b8-b36d-996b2a6a9acc.png
ADDED
Git LFS Details
|
3f6784d1-83eb-4d3d-9547-3375af5496e8.png
ADDED
Git LFS Details
|
404e2ab5-6feb-4531-81f0-9ac6edd14064.png
ADDED
Git LFS Details
|
4179f593-03ac-4133-bfff-14033bf25e8f.png
ADDED
Git LFS Details
|
49cc0707-2203-4144-8ee3-2867c667494e.png
ADDED
Git LFS Details
|
4ff827e7-d5b1-4749-9679-f8d2f09e9d24.png
ADDED
Git LFS Details
|
541583a6-8d5a-4397-a68f-4b74c0d4f1c6.png
ADDED
Git LFS Details
|
5fd07b27-5a52-4bcb-bf3e-d9b7ddd1f2c4.png
ADDED
Git LFS Details
|
72bc8cba-1dfb-4566-ac36-917b9c07cd5d.png
ADDED
Git LFS Details
|
7d00590e-2988-4982-aa44-ff45dd4e085f.png
ADDED
Git LFS Details
|
83ac1ae7-90a4-423f-8bfd-cb50b646f299.png
ADDED
Git LFS Details
|
8d42c3f2-83fa-4989-9ebf-496008597f3d.png
ADDED
Git LFS Details
|
9025c65c-7c4c-4839-abca-98f317f92069.png
ADDED
Git LFS Details
|
98df1d72-2343-44c5-a674-d8f9e3ea2dfa.png
ADDED
Git LFS Details
|
b2050341-7071-4c20-9555-56e16832109b.png
ADDED
Git LFS Details
|
ba61b293-7757-4778-b884-0cde02b4534f.png
ADDED
Git LFS Details
|
c83a9628-7a74-4105-95d5-e202dd96e2e7.png
ADDED
Git LFS Details
|
ca33b991-977a-4b3d-9bae-5b8671c8e5c6.png
ADDED
Git LFS Details
|
d874be25-1ac6-4b36-8272-cbb5428ab3e9.png
ADDED
Git LFS Details
|
da235143-b2ad-489e-b9cd-530e9860b71a.png
ADDED
Git LFS Details
|
f01d742d-efea-4df2-8598-da051f736459.png
ADDED
Git LFS Details
|
f680fb72-0a41-414d-8aae-50faa01a4c02.png
ADDED
Git LFS Details
|
metadata.jsonl
CHANGED
@@ -103,3 +103,32 @@
|
|
103 |
{"file_name": "957feaa7-4f55-44b7-a884-8fd0f56c2980.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from pydantic import BaseModel\r\nfrom typing import Optional\r\n\r\n\r\nclass UserBase(BaseModel):\r\n first_name: str\r\n last_name: str\r\n email_address: str\r\n\r\n \r\nclass UserCreate(UserBase):\r\n password: str\r\n role: str = 'user'\r\n activated: bool = False\r\n \r\nclass UserCreated(UserBase):\r\n id: int\r\n activation_token: str\r\n\r\nclass User(UserBase):\r\n id: int\r\n \r\n class Config:\r\n from_attributes = True\r\n \r\nclass GetUser(BaseModel):\r\n user_id: int\r\n \r\nclass GetUsers(BaseModel):\r\n offset: Optional[int] = 0\r\n limit: Optional[int] = 10\r\n \r\nclass ActivateUser(BaseModel):\r\n user_id: int\r\n activation_token: str\r\n \r\nclass LoginUser(BaseModel):\r\n email_address: str\r\n password: str\r\n "}]}
|
104 |
{"file_name": "66c75360-ef23-4c2f-8764-1fbaaf6219f9.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .create_channel_index import create_channel_index\r\nfrom .create_playlist_index import create_playlist_index\r\nfrom .create_video_index import create_video_index"}]}
|
105 |
{"file_name": "11d14265-f8db-4df2-92a3-0b135b252fb8.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from elasticsearch import Elasticsearch\r\nfrom elastic_transport import ApiError\r\nfrom .....config.logger_config import app_logger\r\n\r\ndef create_channel_index(es_client: Elasticsearch, channels_index: str = 'channels') -> None:\r\n body = {\r\n 'mappings': {\r\n 'properties': {\r\n 'channel_id': {'type': 'keyword'},\r\n 'channel_title': {\r\n 'type': 'text',\r\n 'fields': {\r\n 'raw': {\r\n 'type': 'keyword'\r\n }\r\n }\r\n },\r\n 'published_at': {'type': 'date'},\r\n 'custom_url': {'type': 'keyword'},\r\n 'channel_description': {'type': 'text'},\r\n 'channel_thumbnail': {'type': 'keyword'},\r\n 'views_count': {'type': 'long'},\r\n 'videos_count': {'type': 'long'},\r\n 'subscribers_count': {'type': 'long'}\r\n }\r\n }\r\n }\r\n try:\r\n es_client.indices.delete(index=channels_index, ignore=[400, 404])\r\n es_client.indices.create(index=channels_index, body=body)\r\n except ApiError:\r\n app_logger.error(f\"Unable to create index '{channels_index}'.\")\r\n else:\r\n app_logger.info(f\"Index '{channels_index}' created succsefully.\")\r\n "}]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
{"file_name": "957feaa7-4f55-44b7-a884-8fd0f56c2980.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from pydantic import BaseModel\r\nfrom typing import Optional\r\n\r\n\r\nclass UserBase(BaseModel):\r\n first_name: str\r\n last_name: str\r\n email_address: str\r\n\r\n \r\nclass UserCreate(UserBase):\r\n password: str\r\n role: str = 'user'\r\n activated: bool = False\r\n \r\nclass UserCreated(UserBase):\r\n id: int\r\n activation_token: str\r\n\r\nclass User(UserBase):\r\n id: int\r\n \r\n class Config:\r\n from_attributes = True\r\n \r\nclass GetUser(BaseModel):\r\n user_id: int\r\n \r\nclass GetUsers(BaseModel):\r\n offset: Optional[int] = 0\r\n limit: Optional[int] = 10\r\n \r\nclass ActivateUser(BaseModel):\r\n user_id: int\r\n activation_token: str\r\n \r\nclass LoginUser(BaseModel):\r\n email_address: str\r\n password: str\r\n "}]}
|
104 |
{"file_name": "66c75360-ef23-4c2f-8764-1fbaaf6219f9.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .create_channel_index import create_channel_index\r\nfrom .create_playlist_index import create_playlist_index\r\nfrom .create_video_index import create_video_index"}]}
|
105 |
{"file_name": "11d14265-f8db-4df2-92a3-0b135b252fb8.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from elasticsearch import Elasticsearch\r\nfrom elastic_transport import ApiError\r\nfrom .....config.logger_config import app_logger\r\n\r\ndef create_channel_index(es_client: Elasticsearch, channels_index: str = 'channels') -> None:\r\n body = {\r\n 'mappings': {\r\n 'properties': {\r\n 'channel_id': {'type': 'keyword'},\r\n 'channel_title': {\r\n 'type': 'text',\r\n 'fields': {\r\n 'raw': {\r\n 'type': 'keyword'\r\n }\r\n }\r\n },\r\n 'published_at': {'type': 'date'},\r\n 'custom_url': {'type': 'keyword'},\r\n 'channel_description': {'type': 'text'},\r\n 'channel_thumbnail': {'type': 'keyword'},\r\n 'views_count': {'type': 'long'},\r\n 'videos_count': {'type': 'long'},\r\n 'subscribers_count': {'type': 'long'}\r\n }\r\n }\r\n }\r\n try:\r\n es_client.indices.delete(index=channels_index, ignore=[400, 404])\r\n es_client.indices.create(index=channels_index, body=body)\r\n except ApiError:\r\n app_logger.error(f\"Unable to create index '{channels_index}'.\")\r\n else:\r\n app_logger.info(f\"Index '{channels_index}' created succsefully.\")\r\n "}]}
|
106 |
+
{"file_name": "4ff827e7-d5b1-4749-9679-f8d2f09e9d24.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from setuptools import find_packages, setup\r\nfrom pip._vendor import tomli\r\n\r\n# For consistent encoding\r\nfrom codecs import open\r\nfrom os import path\r\n\r\n# The directory containing this file\r\nHERE = path.abspath(path.dirname(__file__))\r\n\r\n# Get the long description from the README file\r\nwith open(path.join(HERE, \"README.md\"), encoding=\"utf-8\") as f:\r\n LONG_DESCRIPTION = f.read()\r\n\r\nwith open(\"pyproject.toml\", \"r\") as f:\r\n VERSION = tomli.load(f)[\"tool\"][\"commitizen\"][\"version\"]\r\n\r\nDESCRIPTION = \"A python library for generating docstrings for functions and classes.\"\r\n\r\nkey_words = [\"dosctrings\", \"documentation\"]\r\n\r\ninstall_requires = [\r\n \"langchain\",\r\n \"langchain-openai\",\r\n \"black\",\r\n \"pydantic\",\r\n \"pydantic-settings\",\r\n]\r\n\r\nsetup(\r\n name=\"docstring_generator\",\r\n packages=find_packages(\r\n include=[\r\n \"docstring_generator\",\r\n ]\r\n ),\r\n version=VERSION,\r\n description=DESCRIPTION,\r\n long_description_content_type=\"text/markdown\",\r\n long_description=LONG_DESCRIPTION,"}]}
|
107 |
+
{"file_name": "72bc8cba-1dfb-4566-ac36-917b9c07cd5d.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from langchain.prompts import FewShotPromptTemplate, PromptTemplate\r\nfrom langchain_core.pydantic_v1 import BaseModel, Field\r\nfrom langchain_experimental.tabular_synthetic_data.openai import (\r\n OPENAI_TEMPLATE,\r\n create_openai_data_generator,\r\n)\r\nfrom langchain_experimental.tabular_synthetic_data.prompts import (\r\n SYNTHETIC_FEW_SHOT_PREFIX,\r\n SYNTHETIC_FEW_SHOT_SUFFIX,\r\n)\r\nfrom langchain_openai import ChatOpenAI\r\n\r\n\r\nclass Apartment(BaseModel):\r\n apartment_name: str = Field(description=\"The name of the apartment\")\r\n description: str = Field(description=\"The detailed apartment description\")\r\n location: str = Field(\r\n description=\"The town in Kenya where the apartment is located\"\r\n )\r\n monthly_rent: int = Field(\r\n description=\"The monthly rent for the apartment. This is between 5,000 and 50,000 kenyan shillings.\"\r\n )\r\n\r\nraj: str = \"\"\"A three bedroomed apartment located in Juja town, 1.6 km off Thika super highway at Juja \r\nfarm. Apartment features include:\r\n - Kitchen shelves and kitchen cabinets \r\n - electric fence\r\n - 24 hours security\r\n - landscaped common areas\r\n - cabro paved internal roads\r\n - borehole water\r\n - solar heater panels\r\n - bio-digester for waste water treatment\r\n - spacious lounge with separate dining\r\n - high quality ceramic tiles finishing\r\n - recreational & children play area\r\n - designated and visitors car park\r\n - parking space\r\n - Pre-Paid Meter\r\n - Wadrobes"}]}
|
108 |
+
{"file_name": "3f6784d1-83eb-4d3d-9547-3375af5496e8.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": ""}]}
|
109 |
+
{"file_name": "8d42c3f2-83fa-4989-9ebf-496008597f3d.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "import logging\r\nfrom rich.logging import RichHandler\r\nfrom rich.console import Console\r\nfrom rich.prompt import Prompt\r\nfrom rich.prompt import Confirm\r\n\r\n\r\nlogging_format = \"%(asctime)s - %(levelname)s - %(message)s\"\r\ndate_format = \"[%X]\"\r\nhandlers = [RichHandler()]\r\nlogging.basicConfig(\r\n format=logging_format, datefmt=date_format, level=logging.INFO, handlers=handlers\r\n)\r\nconsole = Console()\r\n\r\nintro_path: str = \"intro.txt\"\r\n\r\nwith open(intro_path, \"r\", encoding=\"utf-8\") as f:\r\n intro_txt: str = f.read()\r\n \r\nname_prompt: str = \"To get started, what is your name?\"\r\ncontact_prompt: str = \"Well, {name}, what is your phone number and email address?\"\r\n \r\ndef assistant(text: str) -> None:\r\n assistant_prompt: str = f\"\\n[green bold] :adult-emoji: Assistant:[/green bold] [purple italic]{text}[/purple italic]\"\r\n console.print(assistant_prompt)\r\n \r\ndef assistant_prompt(text: str) -> str:\r\n assistant_prompt: str = f\"\\n[green bold] :adult-emoji: Assistant:[/green bold] [purple italic]{text}[/purple italic]\"\r\n res: str = Prompt.ask(assistant_prompt)\r\n return res\r\n\r\ndef user(text: str) -> str:\r\n user_prompt: str = f\"\\n[red bold] :angel-emoji: User:[/red bold] [yellow italic]{text}[/yellow italic]\"\r\n console.print(user_prompt)\r\n \r\nis_rich_great = Confirm.ask(\"Do you like rich?\")\r\n"}]}
|
110 |
+
{"file_name": "2e7bae0e-1b98-45b8-b36d-996b2a6a9acc.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}]}
|
111 |
+
{"file_name": "5fd07b27-5a52-4bcb-bf3e-d9b7ddd1f2c4.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": ""}]}
|
112 |
+
{"file_name": "f680fb72-0a41-414d-8aae-50faa01a4c02.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from argparse import ArgumentParser\r\n\r\nfrom dotenv import load_dotenv\r\n\r\nload_dotenv()\r\nimport os\r\nfrom os import path\r\n\r\nfrom .config import Config\r\nfrom .docstring_generator import generate_docstrings\r\nfrom .extensions import failed_modules_queue, modules_queue, processed_modules_queue\r\n\r\nparser: ArgumentParser = ArgumentParser()\r\nparser.add_argument(\"--path\", nargs=\"?\", default=\".\", type=str)\r\nparser.add_argument(\"--OPENAI_API_KEY\", nargs=\"?\", default=\"\", type=str)\r\nargs = parser.parse_args()\r\nsource_code_dir: str = args.path\r\n\r\nif not path.exists(source_code_dir):\r\n print(f\"The target directory '{source_code_dir}' doesn't exist\")\r\n raise SystemExit(1)\r\n\r\nif not args.OPENAI_API_KEY and not os.environ.get(\"OPENAI_API_KEY\", None):\r\n print(\"You have not provided the open ai api key.\")\r\n raise SystemExit(1)\r\n\r\nconfig: Config = Config(path=source_code_dir)\r\ngenerate_docstrings(\r\n config=config,\r\n modules_queue=modules_queue,\r\n processed_modules_queue=processed_modules_queue,\r\n failed_modules_queue=failed_modules_queue,\r\n)\r\n"}]}
|
113 |
+
{"file_name": "da235143-b2ad-489e-b9cd-530e9860b71a.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "import ast\r\nfrom ast import ClassDef, FunctionDef, NodeTransformer\r\n\r\nfrom pydantic import BaseModel, Field\r\n\r\nfrom .helpers import (\r\n generate_class_docstring,\r\n generate_function_docstring,\r\n get_class_docstring,\r\n get_class_methods_docstrings,\r\n get_function_docstring,\r\n make_docstring_node,\r\n)\r\n\r\n\r\nclass DocstringWriter(NodeTransformer, BaseModel):\r\n module_code: str = Field(description=\"The modules source code\")\r\n\r\n @property\r\n def module_tree(self):\r\n return ast.parse(self.module_code)\r\n\r\n def visit_ClassDef(self, node):\r\n doc_str: str = ast.get_docstring(node)\r\n for tree_node in self.module_tree.body:\r\n if isinstance(tree_node, ClassDef) and node.name == tree_node.name:\r\n class_code: str = ast.get_source_segment(self.module_code, node)\r\n print(class_code)\r\n class_code_docstring: str = generate_class_docstring(class_code)\r\n class_dcstr = get_class_docstring(class_code_docstring)\r\n new_docstring_node = make_docstring_node(class_dcstr)\r\n if not doc_str:\r\n node.body.insert(0, new_docstring_node)\r\n class_mathods_dcst: dict[str, str] = get_class_methods_docstrings(\r\n class_code_docstring\r\n )\r\n for class_node in node.body:\r\n if isinstance(class_node, FunctionDef):\r\n method_docs: str = class_mathods_dcst[class_node.name]\r\n new_docstring_node = make_docstring_node(method_docs)"}]}
|
114 |
+
{"file_name": "4179f593-03ac-4133-bfff-14033bf25e8f.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": ""}]}
|
115 |
+
{"file_name": "b2050341-7071-4c20-9555-56e16832109b.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from abc import ABC\r\nfrom ..models import Person\r\nfrom ..nodes import Node\r\n\r\n\r\nclass Command(ABC):\r\n def __init__(self, person: Person, node: Node) -> None:\r\n super().__init__()\r\n self._person: Person = person\r\n self._node: Node = node\r\n\r\n def execute(self, user_input: str) -> bool:\r\n return self._node.execute(user_input=user_input)\r\n"}]}
|
116 |
+
{"file_name": "98df1d72-2343-44c5-a674-d8f9e3ea2dfa.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .command import Command\r\n"}]}
|
117 |
+
{"file_name": "9025c65c-7c4c-4839-abca-98f317f92069.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .introduction import Introduction\r\n"}]}
|
118 |
+
{"file_name": "03e55622-8dd2-47c4-b487-ef1ab5be6cbe.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from ...agent import State\r\nfrom ..get_apartment_listings import GetApartmentListings\r\n\r\n\r\nclass GetApartmentDescription(State):\r\n def execute(self) -> None:\r\n self.agent.ui.get_apartment_description()\r\n self.agent.transition_to(GetApartmentListings())\r\n"}]}
|
119 |
+
{"file_name": "f01d742d-efea-4df2-8598-da051f736459.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .get_apartment_description import GetApartmentDescription\r\n"}]}
|
120 |
+
{"file_name": "ba61b293-7757-4778-b884-0cde02b4534f.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from ...agent import State\r\nfrom ..summary import Summary\r\n\r\n\r\nclass GetAppointment(State):\r\n def execute(self) -> None:\r\n self.agent.ui.get_appointment()\r\n self.agent.transition_to(Summary())\r\n"}]}
|
121 |
+
{"file_name": "541583a6-8d5a-4397-a68f-4b74c0d4f1c6.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .get_appointment import GetAppointment\r\n"}]}
|
122 |
+
{"file_name": "c83a9628-7a74-4105-95d5-e202dd96e2e7.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from ..resource import YouTubeResource\r\nfrom ...models import Video, Localized, Statistics, Status, VideoCategory\r\nfrom typing import Any, Callable, Optional\r\nfrom ..schemas.video import VideoFilter, VideoOptionalParameters, VideoPart\r\nfrom ..schemas.resource import Filter, RequestSchema, YouTubeResponse\r\nfrom ..schemas.rating import YouTubeRatingResponse\r\nfrom datetime import datetime\r\nfrom googleapiclient.http import MediaFileUpload\r\n\r\n\r\nclass YouTubeVideo(YouTubeResource):\r\n def __init__(self, youtube_client: Any) -> None:\r\n super().__init__(youtube_client)\r\n \r\n def get_video_ratings(self, video_ids: list[str]) -> YouTubeRatingResponse:\r\n filters: dict = self.generate_filter(self.generate_video_ids, VideoFilter(id=video_ids))\r\n find_video_rating_request: dict = self.youtube_client.videos().getRating(\r\n **filters\r\n )\r\n find_video_rating_result: dict[str, int|str] = find_video_rating_request.execute()\r\n return self.parse_user_video_rating(find_video_rating_result)\r\n \r\n def generate_video_ids(self, video_filter: VideoFilter) -> dict[str, str]:\r\n video_ids: str = ','.join(video_filter.id)\r\n return dict(id=video_ids)\r\n\r\n def find_video_by_id(self, video_id: str) -> Video:\r\n return self.find_videos_by_ids(video_id)[0]\r\n\r\n def find_videos_by_ids(self, video_ids: list[str]) -> list[Video]:\r\n filters: dict = self.generate_filter(self.generate_video_ids, VideoFilter(id=[video_ids]))\r\n part: VideoPart = VideoPart()\r\n optional_params: VideoOptionalParameters = VideoOptionalParameters()\r\n request_schema: RequestSchema = RequestSchema(part=part, filter=filters, optional_parameters=optional_params)\r\n request_dict = self.create_request_dict(request_schema)\r\n request_dict.update(filters)\r\n find_video_request: dict = self.youtube_client.videos().list(\r\n **request_dict\r\n )\r\n find_video_result: dict[str, int|str] = find_video_request.execute()"}]}
|
123 |
+
{"file_name": "09897491-4e9e-4b64-9717-141abb56ee57.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .video import YouTubeVideo"}]}
|
124 |
+
{"file_name": "1f32a984-6c18-4929-8d1b-ed3dc8137f2a.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from typing import Any\r\nfrom ..resource import YouTubeResource\r\nfrom ..schemas import (\r\n YouTubeRequest, YouTubeResponse, CommentThreadFilter, CommentThreadOptionalParameters,\r\n CommentThreadPart\r\n)\r\nfrom ...models import CommentThread, Comment\r\nfrom datetime import datetime\r\n\r\n\r\nclass YouTubeCommentThread(YouTubeResource):\r\n def __init__(self, youtube_client: Any) -> None:\r\n super().__init__(youtube_client)\r\n \r\n def generate_optional_parameters(self, optional_params: CommentThreadOptionalParameters) -> dict:\r\n optional: dict = dict()\r\n for key, value in optional_params.model_dump().items():\r\n if value:\r\n optional[key] = value\r\n return optional\r\n \r\n def generate_filter(self, f: CommentThreadFilter) -> dict:\r\n comment_filter: dict = dict()\r\n for key, value in f.model_dump().items():\r\n if value:\r\n comment_filter[key] = value\r\n break\r\n return comment_filter\r\n \r\n def create_request_dict(self, search_schema: YouTubeRequest) -> dict[str, int|str|datetime]:\r\n request_dict: dict[str, int|str|datetime] = dict()\r\n request_dict['part'] = self.generate_part(search_schema.part)\r\n request_dict.update(self.generate_optional_parameters(search_schema.optional_parameters))\r\n request_dict.update(self.generate_filter(search_schema.filter))\r\n return request_dict\r\n \r\n def find_video_comments(self, request: YouTubeRequest) -> YouTubeResponse:\r\n \"\"\"Get a particular video's comments.\"\"\"\r\n comment_thread_req = self.youtube_client.commentThreads().list(\r\n **self.create_request_dict(request)"}]}
|
125 |
+
{"file_name": "7d00590e-2988-4982-aa44-ff45dd4e085f.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .comment_thread import YouTubeCommentThread"}]}
|
126 |
+
{"file_name": "193d636d-b9c7-4b71-bf57-d295632bd196.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": ""}]}
|
127 |
+
{"file_name": "83ac1ae7-90a4-423f-8bfd-cb50b646f299.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}]}
|
128 |
+
{"file_name": "1ebfd82b-4a08-4a4c-bdeb-6ac27530f13a.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from flask import Blueprint\r\n\r\n\r\nhome = Blueprint(\"home\", __name__)\r\n\r\n\r\n@home.route(\"/\")\r\n@home.route(\"/home\")\r\n@home.route(\"/index\")\r\ndef home_page():\r\n \"\"\"Render the home page.\"\"\"\r\n return 'Home page'"}]}
|
129 |
+
{"file_name": "178d1817-d4fc-4438-b953-57917efb1911.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from contextlib import contextmanager\r\n\r\nfrom flask import current_app\r\nfrom sqlalchemy import create_engine\r\nfrom sqlalchemy.orm import DeclarativeBase, MappedAsDataclass, sessionmaker\r\n\r\nfrom ...config.config import BaseConfig\r\n\r\n\r\nclass Base(MappedAsDataclass, DeclarativeBase):\r\n pass\r\n\r\n\r\nSQLALCHEMY_DATABASE_URI = BaseConfig().db_conn_string\r\nengine = create_engine(SQLALCHEMY_DATABASE_URI)\r\nSession = sessionmaker(bind=engine, autocommit=False, autoflush=False)\r\n\r\n\r\ndef create_all():\r\n Base.metadata.create_all(bind=engine)\r\n\r\n\r\ndef drop_all():\r\n Base.metadata.drop_all(bind=engine)\r\n\r\n\r\n@contextmanager\r\ndef get_db():\r\n try:\r\n db = Session()\r\n yield db\r\n finally:\r\n db.close()\r\n"}]}
|
130 |
+
{"file_name": "159d6b20-9a4a-435d-a5ec-fce2430c9858.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": ""}]}
|
131 |
+
{"file_name": "49cc0707-2203-4144-8ee3-2867c667494e.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from datetime import datetime\r\n\r\nfrom sqlalchemy import ForeignKey\r\nfrom sqlalchemy.orm import Mapped, mapped_column, relationship\r\n\r\nfrom ..database import Base\r\n\r\n\r\nclass Comment(Base):\r\n __tablename__ = \"comments\"\r\n\r\n id: Mapped[str] = mapped_column(primary_key=True)\r\n author_id: Mapped[str] = mapped_column(ForeignKey(\"users.id\"))\r\n post_id: Mapped[str] = mapped_column(ForeignKey(\"posts.id\"))\r\n comment_text: Mapped[str]\r\n comment_date: Mapped[datetime] = mapped_column(default_factory=datetime.utcnow)\r\n\r\n author = relationship(\"User\", back_populates=\"comments\")\r\n post = relationship(\"Post\", back_populates=\"comments\")\r\n"}]}
|
132 |
+
{"file_name": "ca33b991-977a-4b3d-9bae-5b8671c8e5c6.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from datetime import datetime\r\n\r\nfrom sqlalchemy import ForeignKey\r\nfrom sqlalchemy.orm import Mapped, mapped_column, relationship\r\n\r\nfrom ..database import Base\r\n\r\n\r\nclass Post(Base):\r\n __tablename__ = \"posts\"\r\n\r\n id: Mapped[str] = mapped_column(primary_key=True)\r\n author_id: Mapped[str] = mapped_column(ForeignKey(\"users.id\"))\r\n location: Mapped[str]\r\n text: Mapped[str]\r\n image_url: Mapped[str]\r\n date_published: Mapped[datetime] = mapped_column(default_factory=datetime.utcnow)\r\n date_updated: Mapped[datetime] = mapped_column(\r\n onupdate=datetime.utcnow, default_factory=datetime.utcnow\r\n )\r\n\r\n author = relationship(\"User\", back_populates=\"posts\")\r\n bookmarks = relationship(\"Bookmark\", back_populates=\"post\")\r\n likes = relationship(\"Like\", back_populates=\"post\")\r\n comments = relationship(\"Comment\", back_populates=\"post\")\r\n views = relationship(\"View\", back_populates=\"post\")\r\n"}]}
|
133 |
+
{"file_name": "404e2ab5-6feb-4531-81f0-9ac6edd14064.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from .bookmark import Bookmark\r\nfrom .comment import Comment\r\nfrom .like import Like\r\nfrom .post import Post\r\nfrom .user import User\r\nfrom .view import View\r\n"}]}
|
134 |
+
{"file_name": "d874be25-1ac6-4b36-8272-cbb5428ab3e9.png", "messages": [{"role": "SYSTEM", "content": "You are a helpful assistant that knows how to extract python code from images."}, {"role": "USER", "content": "Extract python code from the given image."}, {"role": "ASSISTANT", "content": "from datetime import datetime\r\n\r\nfrom sqlalchemy import ForeignKey\r\nfrom sqlalchemy.orm import Mapped, mapped_column, relationship\r\n\r\nfrom ..database import Base\r\n\r\n\r\nclass View(Base):\r\n __tablename__ = \"views\"\r\n\r\n id: Mapped[str] = mapped_column(primary_key=True)\r\n author_id: Mapped[str] = mapped_column(ForeignKey(\"users.id\"))\r\n post_id: Mapped[str] = mapped_column(ForeignKey(\"posts.id\"))\r\n view_date: Mapped[datetime] = mapped_column(default_factory=datetime.utcnow)\r\n\r\n author = relationship(\"User\", back_populates=\"views\")\r\n post = relationship(\"Post\", back_populates=\"views\")\r\n"}]}
|