I've created three improved templates for your code generation use case, each with different levels of detail and structure. All are significant improvements over your original template.
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
| """ | |
| Vector Processing Pipeline Service | |
| This module provides a FastAPI service for text segment processing through various | |
| stages including embedding, clustering, and dimensionality reduction (planarization). | |
| The service allows for: | |
| - Individual processing of segments through specific stages | |
| - Pipeline processing that combines multiple stages efficiently |
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
| """ | |
| This module defines a FastAPI application that demonstrates a simple pipeline | |
| processing system. The system allows users to specify which stages they want | |
| to include in the processing pipeline, and the system will automatically | |
| compute and return the results for those stages. | |
| """ | |
| from fastapi import FastAPI, Depends, HTTPException | |
| from pydantic import BaseModel | |
| from typing import ( |
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 urllib.parse import urlparse | |
| import os | |
| from functools import lru_cache | |
| def ensure_raw_github_url(url): | |
| """ | |
| This function takes a GitHub URL and returns the raw version of the URL. | |
| Args: |
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
| # Note, the only two third party packages your need are: | |
| # pip install dol | |
| # pip install request | |
| import os | |
| import requests | |
| from typing import Dict, Union, MutableMapping, KT, VT, TypeVar, Callable, Any | |
| from functools import partial |
The following code contains tools to get from video or audio to text and key takeaways for developers. Can be applied to video, audio or text, so can be used from meeting recordings, video demos, etc.
The following code is also meant to be a demo of the dol tools Pipe and written_key as well as the oa.prompt_function tool.
Requires dol, oa, speech_recognition and moviepy to be installed, though the last two are contained in functions and could be replaced.
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
| api_costs = { | |
| 'gpt-4-1106-preview': {"input": 0.01, "output": 0.03, "unit": "$/1K tokens"}, | |
| 'gpt-4-1106-vision-preview': {"input": 0.01, "output": 0.03, "unit": "$/1K tokens"}, | |
| 'gpt-4': {"input": 0.03, "output": 0.06, "unit": "$/1K tokens"}, | |
| 'gpt-4-32k': {"input": 0.06, "output": 0.12, "unit": "$/1K tokens"}, | |
| 'gpt-3.5-turbo-1106': {"input": 0.0010, "output": 0.0020, "unit": "$/1K tokens"}, | |
| 'gpt-3.5-turbo-instruct': {"input": 0.0015, "output": 0.0020, "unit": "$/1K tokens"}, | |
| 'gpt-3.5-turbo': {"training": 0.0080, "input": 0.0030, "output": 0.0060, "unit": "$/1K tokens"}, | |
| 'davinci-002': {"training": 0.0060, "input": 0.0120, "output": 0.0120, "unit": "$/1K tokens"}, | |
| 'babbage-002': {"training": 0.0004, "input": 0.0016, "output": 0.0016, "unit": "$/1K tokens"}, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 tested import validate_codec | |
| Empty1 = type('Empty', (), {})() | |
| print("\nEmpty1 = type('Empty', (), {})()") | |
| print(f"{validate_codec(Empty1)=}") | |
| _Empty2 = type('Empty', (), {}) | |
| _Empty2.__module__ = __name__ |
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
| # get raw df | |
| import qo | |
| df = qo.get_tables_from_url('https://en.wikipedia.org/wiki/List_of_salaries_of_heads_of_state_and_government')[3] | |
| df = df.set_index('State') | |
| # formatting and extracting salaries |
NewerOlder