Generate FAQ for README¶
This notebook shows how to generate multilingual FAQ drafts from a source markdown document.
In [1]:
Copied!
import json
import pandas as pd
from openai import OpenAI
from pydantic import BaseModel, Field
import openaivec
from openaivec import pandas_ext
openaivec.set_client(OpenAI())
openaivec.set_responses_model("gpt-5.4")
import json
import pandas as pd
from openai import OpenAI
from pydantic import BaseModel, Field
import openaivec
from openaivec import pandas_ext
openaivec.set_client(OpenAI())
openaivec.set_responses_model("gpt-5.4")
In [2]:
Copied!
docs_df: pd.DataFrame = pd.DataFrame(
{"title": "readme", "body": [open("../../README.md").read()]}
)
docs_df
docs_df: pd.DataFrame = pd.DataFrame(
{"title": "readme", "body": [open("../../README.md").read()]}
)
docs_df
Out[2]:
| title | body | |
|---|---|---|
| 0 | readme | # openaivec\n\nAI text processing for pandas a... |
In [3]:
Copied!
class Question(BaseModel):
question: str = Field(description="The question to ask the model.")
answer: str = Field(description="The answer to the question.")
class Section(BaseModel):
title: str = Field(description="The title of the section.")
content: str = Field(description="The content of the section.")
questions: list[Question] = Field(description="List of questions and answers related to the section.")
class Document(BaseModel):
sections: list[Section] = Field(description="List of sections in the document.")
class Question(BaseModel):
question: str = Field(description="The question to ask the model.")
answer: str = Field(description="The answer to the question.")
class Section(BaseModel):
title: str = Field(description="The title of the section.")
content: str = Field(description="The content of the section.")
questions: list[Question] = Field(description="List of questions and answers related to the section.")
class Document(BaseModel):
sections: list[Section] = Field(description="List of sections in the document.")
In [4]:
Copied!
sections_df = docs_df.pipe(
lambda df: df
.assign(
section=lambda df: df["body"].ai.responses(
instructions="""
Generate a list of FAQ for each section of the document.
Break down the document into as many detailed sections as possible,
regardless of markdown format.
""",
response_format=Document
)
.map(lambda x: x.sections)
)
.drop(columns=["body"])
.explode("section")
.ai.extract("section")
)
sections_df
sections_df = docs_df.pipe(
lambda df: df
.assign(
section=lambda df: df["body"].ai.responses(
instructions="""
Generate a list of FAQ for each section of the document.
Break down the document into as many detailed sections as possible,
regardless of markdown format.
""",
response_format=Document
)
.map(lambda x: x.sections)
)
.drop(columns=["body"])
.explode("section")
.ai.extract("section")
)
sections_df
Processing batches: 0%| | 0/1 [00:00<?, ?item/s]
Out[4]:
| title | section_title | section_content | section_questions | |
|---|---|---|---|---|
| 0 | readme | Project Title | openaivec is a library for AI text processing ... | [{'question': 'What is openaivec?', 'answer': ... |
| 0 | readme | Contributor Guidelines Reference | The document links to contributor guidelines i... | [{'question': 'Where are the contributor guide... |
| 0 | readme | Quick Start Overview | The quick start shows how to install openaivec... | [{'question': 'How do I install openaivec?', '... |
| 0 | readme | Quick Start Installation | Installation is done with pip using the comman... | [{'question': 'What is the installation comman... |
| 0 | readme | Quick Start pandas Example | The example imports os, pandas, and openaivec'... | [{'question': 'How do I use openaivec with a p... |
| ... | ... | ... | ... | ... |
| 0 | readme | Additional Resource: Survey Data Transformation | A tutorial is provided for transforming unstru... | [{'question': 'Is there an example for survey ... |
| 0 | readme | Additional Resource: Async Processing Examples | A tutorial is provided for high-performance as... | [{'question': 'Are there dedicated async workf... |
| 0 | readme | Additional Resource: FAQ Generation | A tutorial is provided for automatically gener... | [{'question': 'Is there an example for generat... |
| 0 | readme | Additional Resource: All Examples | A complete collection of tutorials and use cas... | [{'question': 'Where can I browse all openaive... |
| 0 | readme | Community | The project has a Discord community for suppor... | [{'question': 'Is there a community for openai... |
62 rows × 4 columns
In [5]:
Copied!
questions_df: pd.DataFrame = sections_df.pipe(
lambda df: df
.drop(columns=["section_content"])
.explode("section_questions")
.ai.extract("section_questions")
.reset_index(drop=True)
)
questions_df: pd.DataFrame = sections_df.pipe(
lambda df: df
.drop(columns=["section_content"])
.explode("section_questions")
.ai.extract("section_questions")
.reset_index(drop=True)
)
In [6]:
Copied!
from IPython.display import Markdown, display
display(Markdown(questions_df.to_markdown()))
from IPython.display import Markdown, display
display(Markdown(questions_df.to_markdown()))
| title | section_title | section_questions_question | section_questions_answer | |
|---|---|---|---|---|
| 0 | readme | Project Title | What is openaivec? | openaivec is a Python library for vectorized AI text processing across pandas and Spark. |
| 1 | readme | Project Title | What problem does openaivec solve? | It helps you run the same prompt over many inputs efficiently using batching, caching, and deduplication. |
| 2 | readme | Project Title | Which data tools does openaivec support? | It supports pandas and Apache Spark. |
| 3 | readme | Contributor Guidelines Reference | Where are the contributor guidelines located? | They are linked in AGENTS.md. |
| 4 | readme | Contributor Guidelines Reference | Is there a dedicated contribution guide reference in the document? | Yes, the document references contributor guidelines through AGENTS.md. |
| 5 | readme | Quick Start Overview | How do I install openaivec? | Install it with pip using pip install openaivec. |
| 6 | readme | Quick Start Overview | What does the quick start example demonstrate? | It demonstrates using pandas with the .ai.responses() accessor to translate fruit names into French. |
| 7 | readme | Quick Start Overview | Do I need to set an API key before using openaivec? | Yes, the example sets OPENAI_API_KEY in the environment before calling the API. |
| 8 | readme | Quick Start Installation | What is the installation command for openaivec? | Use pip install openaivec. |
| 9 | readme | Quick Start Installation | Do I need a package manager other than pip to install openaivec? | The quick start shows pip as the installation method. |
| 10 | readme | Quick Start pandas Example | How do I use openaivec with a pandas Series? | Import pandas_ext, create a Series, and call .ai.responses() with a prompt on the Series. |
| 11 | readme | Quick Start pandas Example | Why is from openaivec import pandas_ext included? |
It enables the pandas AI accessors such as .ai and .aio. |
| 12 | readme | Quick Start pandas Example | What output does the fruit translation example return? | It returns ['pomme', 'banane', 'cerise'] for apple, banana, and cherry. |
| 13 | readme | Quick Start Azure and Custom Client Note | Where can I find Azure OpenAI setup instructions for pandas? | See the section titled pandas authentication options. |
| 14 | readme | Quick Start Azure and Custom Client Note | Where are custom client setup instructions documented? | They are referenced in the pandas authentication options section. |
| 15 | readme | Pandas Tutorial Link | Is there a full pandas tutorial for openaivec? | Yes, a pandas tutorial is available on GitHub Pages. |
| 16 | readme | Pandas Tutorial Link | Where is the pandas tutorial hosted? | It is hosted at https://microsoft.github.io/openaivec/examples/pandas/. |
| 17 | readme | Benchmarks Overview | What does the benchmark measure? | It measures execution time for processing 100 numeric strings into integer literals using Series.aio.responses. |
| 18 | readme | Benchmarks Overview | Which model was used in the benchmark? | The benchmark used gpt-5.1. |
| 19 | readme | Benchmarks Overview | What is the main takeaway from the benchmark? | Batching removes most HTTP overhead, and concurrency reduces total runtime further. |
| 20 | readme | Benchmark Mode: Serial | What settings define serial benchmark mode? | Serial mode uses batch_size=1 and max_concurrency=1. |
| 21 | readme | Benchmark Mode: Serial | How long did serial mode take in the benchmark? | It took about 141 seconds. |
| 22 | readme | Benchmark Mode: Batching | What settings define batching benchmark mode? | It uses the default batch_size and max_concurrency=1. |
| 23 | readme | Benchmark Mode: Batching | How long did batching mode take? | It took about 15 seconds. |
| 24 | readme | Benchmark Mode: Concurrent Batching | What settings define concurrent batching mode? | It uses the default batch_size and default max_concurrency. |
| 25 | readme | Benchmark Mode: Concurrent Batching | How long did concurrent batching take? | It took about 6 seconds. |
| 26 | readme | Benchmark Mode: Concurrent Batching | Why is concurrent batching faster than batching alone? | Because it overlaps batched requests using concurrency while still producing one output per input. |
| 27 | readme | Contents Navigation | What major topics are covered in the document? | It covers project motivation, workflows, authentication, Spark, prompting, Fabric, contributing, resources, and community. |
| 28 | readme | Contents Navigation | Does the document include both pandas and Spark guidance? | Yes, it includes separate sections for both pandas and Spark usage and authentication. |
| 29 | readme | Why openaivec? Overview | Why would someone choose openaivec? | Because it provides convenient pandas and Spark integrations, optimized batching, caching, retries, reasoning support, and reusable task and prompt tooling. |
| 30 | readme | Why openaivec? Overview | Is openaivec designed only for small local data tasks? | No, it also supports Spark UDFs and production-scale ETL scenarios. |
| 31 | readme | Why openaivec?: pandas Accessors | What are .ai and .aio in openaivec? |
They are pandas accessors for synchronous and asynchronous AI operations. |
| 32 | readme | Why openaivec?: pandas Accessors | Why are the pandas accessors useful? | They keep AI workflows inside familiar pandas patterns. |
| 33 | readme | Why openaivec?: Batch Optimization | What do BatchCache and AsyncBatchCache do? |
They optimize batch requests by coalescing calls, deduplicating prompts, preserving output order, and handling failures cleanly. |
| 34 | readme | Why openaivec?: Batch Optimization | Does openaivec preserve output order during batching? | Yes, it preserves the original order of outputs. |
| 35 | readme | Why openaivec?: Batch Optimization | How does openaivec behave on batch failure? | It releases waiters even when upstream errors occur. |
| 36 | readme | Why openaivec?: Reasoning and Structured Outputs | Does openaivec support reasoning models? | Yes, it supports reasoning models using semantics that mirror the OpenAI SDK. |
| 37 | readme | Why openaivec?: Reasoning and Structured Outputs | Can openaivec handle structured outputs? | Yes, it supports structured outputs with Pydantic response_format. |
| 38 | readme | Why openaivec?: Caching and Retries | Does openaivec include caching? | Yes, it includes built-in caching features. |
| 39 | readme | Why openaivec?: Caching and Retries | Can pandas and async workflows share caches? | Yes, they can share caches explicitly. |
| 40 | readme | Why openaivec?: Caching and Retries | How does Spark handle repeated inputs? | Spark UDFs deduplicate repeated inputs within each partition. |
| 41 | readme | Why openaivec?: Production and Prompt Tooling | Does openaivec include prompt-building tools? | Yes, it includes tools like FewShotPromptBuilder and improve. |
| 42 | readme | Why openaivec?: Production and Prompt Tooling | Are there prebuilt tasks in openaivec? | Yes, it ships a task library with curated prompts and validated outputs. |
| 43 | readme | Why openaivec?: Production and Prompt Tooling | Can openaivec support production ETL workflows? | Yes, Spark UDFs and Fabric guidance are intended to help move notebook workflows into production-scale ETL. |
| 44 | readme | Overview | What is meant by vectorized OpenAI batch processing? | It means handling many inputs in grouped calls rather than making one API request per input. |
| 45 | readme | Overview | Does openaivec require a specific Python version? | Yes, it requires Python 3.10 or newer. |
| 46 | readme | Overview | Can prompts be reused across pandas and async workflows? | Yes, shared-cache helpers can reuse prompts across both. |
| 47 | readme | Core Workflows Overview | What workflows does openaivec support? | It supports direct API usage, pandas integration, reasoning-model usage, task-based workflows, async processing, and Spark UDFs. |
| 48 | readme | Core Workflows Overview | Is pandas the only way to use openaivec? | No, you can also use direct API clients, async accessors, and Spark UDF helpers. |
| 49 | readme | Direct API Usage | How do I use openaivec directly without pandas? | Create a BatchResponses client with BatchResponses.of(...) and call .parse() on a list of inputs. |
| 50 | readme | Direct API Usage | Why would I choose direct API usage? | It gives maximum control over batch client configuration and processing behavior. |
| 51 | readme | Direct API Usage | What configuration options are shown in the direct API example? | The example sets the OpenAI client, model name, system message, and uses the default automatic batch size. |
| 52 | readme | Direct API Usage: BatchResponses Example | What class is used for direct batch response processing? | BatchResponses is used for direct batch response processing. |
| 53 | readme | Direct API Usage: BatchResponses Example | What model is used in the direct API example? | The example uses gpt-5.1. |
| 54 | readme | Direct API Usage: BatchResponses Example | What result is expected from the direct parse example? | The expected result is ['bear family', 'rabbit family', 'koala family']. |
| 55 | readme | Direct API Tutorial Link | Is there a full tutorial for direct or pandas-style workflows? | Yes, the document links to a complete tutorial at the examples site. |
| 56 | readme | pandas Authentication Options Overview | When should I configure pandas authentication? | Before using .ai or .aio accessors. |
| 57 | readme | pandas Authentication Options Overview | What authentication options are available for pandas? | OpenAI API key, Azure OpenAI API key, Azure OpenAI with Entra ID, and custom client setup. |
| 58 | readme | pandas Authentication: OpenAI API Key | How do I authenticate openaivec with OpenAI for pandas? | Set OPENAI_API_KEY in your environment. |
| 59 | readme | pandas Authentication: OpenAI API Key | Which environment variable is used for OpenAI authentication? | OPENAI_API_KEY. |
| 60 | readme | pandas Authentication: Azure OpenAI API Key | Which environment variables are required for Azure OpenAI API key authentication in pandas? | AZURE_OPENAI_API_KEY, AZURE_OPENAI_BASE_URL, and AZURE_OPENAI_API_VERSION. |
| 61 | readme | pandas Authentication: Azure OpenAI API Key | What API version should be used with the /openai/v1/ Azure base URL? |
Use AZURE_OPENAI_API_VERSION="v1". |
| 62 | readme | pandas Authentication: Azure OpenAI API Key | What should the Azure base URL look like? | It should look like https://YOUR-RESOURCE-NAME.services.ai.azure.com/openai/v1/. |
| 63 | readme | pandas Authentication: Azure OpenAI with Entra ID | How do I use Azure OpenAI with Entra ID instead of an API key? | Set the Azure base URL and API version, and remove AZURE_OPENAI_API_KEY from the environment. |
| 64 | readme | pandas Authentication: Azure OpenAI with Entra ID | What credential does openaivec use when AZURE_OPENAI_API_KEY is not set? |
It uses DefaultAzureCredential. |
| 65 | readme | pandas Authentication: Custom Clients | Can I use custom OpenAI clients with openaivec? | Yes, you can set custom sync and async clients. |
| 66 | readme | pandas Authentication: Custom Clients | How do I register a custom sync client? | Call openaivec.set_client(OpenAI()). |
| 67 | readme | pandas Authentication: Custom Clients | How do I register a custom async client? | Call openaivec.set_async_client(AsyncOpenAI()). |
| 68 | readme | pandas Integration Overview | What is the recommended way to use openaivec with DataFrames? | Use the pandas integration with .ai.responses() after setting up authentication and a default model. |
| 69 | readme | pandas Integration Overview | Can openaivec add AI-generated columns to a DataFrame? | Yes, it can be used inside df.assign(...) to create new columns. |
| 70 | readme | pandas Integration Example | How do I set a default responses model for pandas workflows? | Use openaivec.set_responses_model("gpt-5.1"). |
| 71 | readme | pandas Integration Example | How is .ai.responses() used inside a DataFrame pipeline? |
It can be called on a Series within df.assign(...) to generate a new column. |
| 72 | readme | pandas Integration Example | What values are shown in the example output? | The output maps panda to bear family, rabbit to rabbit family, and koala to marsupial family. |
| 73 | readme | Reasoning Models Overview | Does openaivec support reasoning models? | Yes, it supports reasoning models and follows OpenAI SDK semantics. |
| 74 | readme | Reasoning Models Overview | Can I override reasoning settings per request? | Yes, by passing a reasoning dictionary. |
| 75 | readme | Reasoning Models Overview | Do I have to specify reasoning every time? |
No, you can omit it and use the model defaults. |
| 76 | readme | Reasoning Models Example | How do I set a reasoning model in openaivec? | Use openaivec.set_responses_model("o1-mini") or another reasoning-capable model. |
| 77 | readme | Reasoning Models Example | What shape should the reasoning argument have? |
It should be a dictionary matching OpenAI SDK semantics, such as {"effort": "none"}. |
| 78 | readme | Pre-configured Tasks Overview | What are pre-configured tasks in openaivec? | They are reusable task definitions for common operations like sentiment or intent analysis. |
| 79 | readme | Pre-configured Tasks Overview | Why use tasks instead of raw prompts? | Tasks simplify common workflows and can provide validated, structured outputs. |
| 80 | readme | Pre-configured Tasks Example | How do I run a predefined task on a pandas column? | Call .ai.task(...) with a task object such as nlp.sentiment_analysis(). |
| 81 | readme | Pre-configured Tasks Example | What task categories are shown in the example? | The example shows NLP sentiment analysis and customer support intent analysis. |
| 82 | readme | Pre-configured Tasks Example | How do I extract structured task results into columns? | Use .ai.extract("sentiment") or another field name on the results. |
| 83 | readme | Asynchronous Processing Overview | What is .aio in openaivec? |
.aio is the asynchronous accessor for AI operations on pandas objects. |
| 84 | readme | Asynchronous Processing Overview | When should I use .aio instead of .ai? |
Use .aio for high-throughput or asynchronous workflows where concurrency improves performance. |
| 85 | readme | Asynchronous Processing Example | How do I run asynchronous response generation on a pandas Series? | Use await series.aio.responses(...) inside an async function. |
| 86 | readme | Asynchronous Processing Example | How is the async workflow executed from regular Python code? | The example uses asyncio.run(process_data()). |
| 87 | readme | Asynchronous Processing Example | What does max_concurrency=12 do? |
It allows up to 12 concurrent requests in the async workflow. |
| 88 | readme | Asynchronous Processing Benefits | What are the benefits of .aio processing? |
It provides parallelism, batching, deduplication, rate limiting, error handling, and memory-efficient streaming. |
| 89 | readme | Asynchronous Processing Benefits | Is async processing useful for large datasets? | Yes, it is designed for high-throughput and large-data workloads. |
| 90 | readme | Apache Spark UDFs Overview | Can openaivec be used with Apache Spark? | Yes, it supports Apache Spark through helper functions and UDF builders. |
| 91 | readme | Apache Spark UDFs Overview | What is the purpose of the Spark section? | It explains how to scale openaivec workflows to distributed datasets using Spark UDFs. |
| 92 | readme | Spark Tutorial Link | Is there a Spark tutorial for openaivec? | Yes, a Spark tutorial is available online. |
| 93 | readme | Spark Tutorial Link | Where is the Spark tutorial located? | At https://microsoft.github.io/openaivec/examples/spark/. |
| 94 | readme | Spark Authentication Options Overview | What authentication options are available for Spark? | OpenAI API key, Azure OpenAI API key, and Azure OpenAI with Entra ID. |
| 95 | readme | Spark Authentication Options Overview | When should Spark authentication be configured? | Before registering and using UDFs. |
| 96 | readme | Spark Authentication: OpenAI API Key | How do I configure Spark for OpenAI API key authentication? | Call setup(spark, api_key=..., responses_model_name=..., embeddings_model_name=...). |
| 97 | readme | Spark Authentication: OpenAI API Key | What model settings are provided in the OpenAI Spark setup example? | It sets responses_model_name="gpt-5.1" and embeddings_model_name="text-embedding-3-small". |
| 98 | readme | Spark Authentication: Azure OpenAI API Key | How do I configure Spark for Azure OpenAI with an API key? | Use setup_azure(...) with your Spark session, API key, base URL, API version, and deployment names. |
| 99 | readme | Spark Authentication: Azure OpenAI API Key | Should I use deployment names or model names in the Azure Spark setup? | The example uses deployment names such as my-gpt-deployment and my-embedding-deployment. |
| 100 | readme | Spark Authentication: Azure OpenAI API Key | What Azure URL and version format is required? | Use a base URL ending in /openai/v1/ and api_version="v1". |
| 101 | readme | Spark Authentication: Azure OpenAI with Entra ID | How do I use Azure OpenAI with Entra ID in Spark scenarios? | Set the Azure environment variables, unset the API key, and rely on DefaultAzureCredential. |
| 102 | readme | Spark Authentication: Azure OpenAI with Entra ID | What happens if AZURE_OPENAI_API_KEY is unset? |
openaivec uses DefaultAzureCredential. |
| 103 | readme | Spark UDF Registration | How do I register a response-based Spark UDF? | Use spark.udf.register(...) with a helper like responses_udf(...). |
| 104 | readme | Spark UDF Registration | What does the extract_brand example do? |
It extracts just the brand name from product descriptions. |
| 105 | readme | Spark UDF Registration | Can I pass reasoning settings to Spark UDF helpers? | Yes, the example passes reasoning={"effort": "none"}. |
| 106 | readme | Spark UDF Usage Example | How do I use a registered openaivec Spark UDF in a query? | Use it in Spark SQL expressions such as selectExpr("product_name", "extract_brand(product_name) AS brand"). |
| 107 | readme | Spark UDF Usage Example | What sample inputs are shown for the brand extraction UDF? | Nike Air Max and Apple iPhone 15. |
| 108 | readme | Other Spark Helper UDFs | What other Spark helper UDFs are available? | task_udf, embeddings_udf, count_tokens_udf, similarity_udf, and parse_udf. |
| 109 | readme | Other Spark Helper UDFs | Does openaivec support Spark embeddings and similarity operations? | Yes, helper UDFs are provided for embeddings and similarity. |
| 110 | readme | Spark Performance Tips | How does openaivec optimize Spark UDF performance? | It deduplicates repeated inputs per partition and supports batching and concurrency tuning. |
| 111 | readme | Spark Performance Tips | What is the recommended default for batch_size in Spark? |
Use batch_size=None for auto-optimization unless you need a fixed size. |
| 112 | readme | Spark Performance Tips | What fixed batch_size range is suggested if tuning manually? |
A range of 32 to 128 is suggested. |
| 113 | readme | Spark Performance Tips | How should I think about max_concurrency in Spark? |
It is per executor, so total concurrency equals executors multiplied by max_concurrency. |
| 114 | readme | Spark Performance Tips | What starting max_concurrency is recommended? |
Start with 4 to 12. |
| 115 | readme | Spark Performance Tips | What external constraint should I monitor while tuning Spark concurrency? | You should monitor rate limits based on your OpenAI usage tier. |
| 116 | readme | Building Prompts Overview | Does openaivec help with prompt design? | Yes, it includes FewShotPromptBuilder and improve() for building and refining prompts. |
| 117 | readme | Building Prompts Overview | Why use few-shot prompts? | Few-shot prompts can improve LLM output quality by giving clearer examples and instructions. |
| 118 | readme | FewShotPromptBuilder Example | How do I create a few-shot prompt in openaivec? | Use FewShotPromptBuilder() and chain methods like .purpose(), .caution(), .example(), .improve(), and .build(). |
| 119 | readme | FewShotPromptBuilder Example | What does .improve(max_iter=1) do? |
It optionally refines the prompt, using OpenAI, for one iteration. |
| 120 | readme | FewShotPromptBuilder Example | What examples are shown in the prompt builder sample? | Apple -> Fruit and Car -> Vehicle. |
| 121 | readme | Advanced Prompting Tutorial Link | Is there a tutorial for advanced prompting? | Yes, the document links to one. |
| 122 | readme | Advanced Prompting Tutorial Link | Where can I learn more about prompting with openaivec? | At https://microsoft.github.io/openaivec/examples/prompt/. |
| 123 | readme | Microsoft Fabric Overview | Can openaivec be used in Microsoft Fabric? | Yes, it can be installed from PyPI in a Fabric environment and used with Spark notebooks. |
| 124 | readme | Microsoft Fabric Overview | How do I use openaivec in Microsoft Fabric? | Add it from PyPI to your Fabric environment, select that environment in your notebook, and use openaivec.spark as you would in standard Spark. |
| 125 | readme | Contributing Overview | Does the project accept contributions? | Yes, contributions are welcome. |
| 126 | readme | Contributing Overview | What branch should contributors start from? | They should fork and branch from main. |
| 127 | readme | Contributing Overview | Should contributors update tests when changing code? | Yes, they should add or update tests as needed. |
| 128 | readme | Contributing Overview | What should be done before opening a PR? | Run formatting and tests before opening the pull request. |
| 129 | readme | Contributing: Install Dev Dependencies | How do I install development dependencies? | Run uv sync --all-extras --dev. |
| 130 | readme | Contributing: Lint and Format | How do I lint and format the codebase? | Run uv run ruff check . --fix. |
| 131 | readme | Contributing: Lint and Format | Which tool is used for linting and formatting in the example? | Ruff is used in the provided command. |
| 132 | readme | Contributing: Test Command | How do I run the recommended quick test suite? | Run uv run pytest -m "not slow and not requires_api". |
| 133 | readme | Contributing: Test Command | What kinds of tests are excluded in the quick test command? | Tests marked slow and requires_api are excluded. |
| 134 | readme | Additional Resources Overview | Does the project provide additional tutorials and examples? | Yes, it links to several tutorials and use-case examples. |
| 135 | readme | Additional Resources Overview | What kinds of example projects are available? | Examples include customer feedback analysis, survey transformation, async workflows, FAQ generation, and a full collection of tutorials. |
| 136 | readme | Additional Resource: Customer Feedback Analysis | Is there an example for analyzing customer feedback? | Yes, there is a tutorial covering sentiment analysis and prioritization. |
| 137 | readme | Additional Resource: Customer Feedback Analysis | Where can I find the customer feedback analysis example? | At https://microsoft.github.io/openaivec/examples/customer_analysis/. |
| 138 | readme | Additional Resource: Survey Data Transformation | Is there an example for survey data transformation? | Yes, there is a tutorial for converting unstructured survey data into structured data. |
| 139 | readme | Additional Resource: Survey Data Transformation | Where is the survey transformation tutorial located? | At https://microsoft.github.io/openaivec/examples/survey_transformation/. |
| 140 | readme | Additional Resource: Async Processing Examples | Are there dedicated async workflow examples? | Yes, the document links to asynchronous processing examples. |
| 141 | readme | Additional Resource: Async Processing Examples | Where can I find async processing examples? | At https://microsoft.github.io/openaivec/examples/aio/. |
| 142 | readme | Additional Resource: FAQ Generation | Is there an example for generating FAQs from documents? | Yes, there is a tutorial on auto-generating FAQs using AI. |
| 143 | readme | Additional Resource: FAQ Generation | Where is the FAQ generation example? | At https://microsoft.github.io/openaivec/examples/generate_faq/. |
| 144 | readme | Additional Resource: All Examples | Where can I browse all openaivec examples? | At https://microsoft.github.io/openaivec/examples/pandas/ as linked in the document. |
| 145 | readme | Additional Resource: All Examples | Is there a central collection of tutorials? | Yes, the document links to a complete collection of tutorials and use cases. |
| 146 | readme | Community | Is there a community for openaivec users? | Yes, there is a Discord community. |
| 147 | readme | Community | What is the community link? | The Discord link is https://discord.gg/hXCS9J6Qek. |
| 148 | readme | Community | What is the Discord community used for? | It is for support and announcements. |
In [7]:
Copied!
ja_questions_df: pd.DataFrame = questions_df.pipe(
lambda df: df
.ai.responses(
instructions="""
Translate given json into japanese with same schema.
Just return the json without any additional text.
"""
)
.map(json.loads)
.ai.extract()
)
ja_questions_df: pd.DataFrame = questions_df.pipe(
lambda df: df
.ai.responses(
instructions="""
Translate given json into japanese with same schema.
Just return the json without any additional text.
"""
)
.map(json.loads)
.ai.extract()
)
Processing batches: 0%| | 0/149 [00:00<?, ?item/s]
In [8]:
Copied!
display(Markdown(ja_questions_df.to_markdown()))
display(Markdown(ja_questions_df.to_markdown()))
| record_title | record_section_title | record_section_questions_question | record_section_questions_answer | |
|---|---|---|---|---|
| 0 | readme | プロジェクトタイトル | openaivecとは何ですか? | openaivecは、pandasとSpark全体でベクトル化されたAIテキスト処理を行うためのPythonライブラリです。 |
| 1 | readme | プロジェクトタイトル | openaivecはどのような問題を解決しますか? | バッチ処理、キャッシュ、重複排除を使って、多くの入力に対して同じプロンプトを効率的に実行できるようにします。 |
| 2 | readme | プロジェクトタイトル | openaivecはどのデータツールをサポートしていますか? | pandasとApache Sparkをサポートしています。 |
| 3 | readme | コントリビューターガイドライン参照 | コントリビューターガイドラインはどこにありますか? | AGENTS.mdにリンクされています。 |
| 4 | readme | コントリビューターガイドライン参照 | この文書には専用のコントリビューションガイド参照がありますか? | はい、この文書ではAGENTS.mdを通じてコントリビューターガイドラインを参照しています。 |
| 5 | readme | クイックスタート概要 | openaivecをインストールするにはどうすればよいですか? | pip install openaivec を使ってpipでインストールします。 |
| 6 | readme | クイックスタート概要 | クイックスタートの例では何を示していますか? | .ai.responses() アクセサを使って、pandasで果物の名前をフランス語に翻訳する方法を示しています。 |
| 7 | readme | クイックスタート概要 | openaivecを使う前にAPIキーを設定する必要がありますか? | はい、この例ではAPIを呼び出す前に環境変数に OPENAI_API_KEY を設定しています。 |
| 8 | readme | クイックスタートのインストール | openaivecのインストールコマンドは何ですか? | pip install openaivec を使用します。 |
| 9 | readme | クイックスタートのインストール | openaivecをインストールするのにpip以外のパッケージマネージャーは必要ですか? | クイックスタートでは、インストール方法としてpipが示されています。 |
| 10 | readme | クイックスタート pandas の例 | pandas の Series で openaivec を使うにはどうすればよいですか? | pandas_ext をインポートし、Series を作成して、その Series に対してプロンプト付きで .ai.responses() を呼び出します。 |
| 11 | readme | クイックスタート pandas の例 | なぜ from openaivec import pandas_ext を含めるのですか? |
.ai や .aio などの pandas AI アクセサを有効にするためです。 |
| 12 | readme | クイックスタート pandas の例 | 果物の翻訳例はどのような出力を返しますか? | apple、banana、cherry に対して ['pomme', 'banane', 'cerise'] を返します。 |
| 13 | readme | クイックスタート Azure とカスタムクライアントに関する注記 | pandas 向けの Azure OpenAI セットアップ手順はどこで確認できますか? | pandas authentication options というタイトルのセクションを参照してください。 |
| 14 | readme | クイックスタート Azure とカスタムクライアントに関する注記 | カスタムクライアントのセットアップ手順はどこに記載されていますか? | pandas authentication options セクションで参照されています。 |
| 15 | readme | Pandas チュートリアルへのリンク | openaivec には pandas の完全なチュートリアルがありますか? | はい、GitHub Pages で pandas チュートリアルが公開されています。 |
| 16 | readme | Pandas チュートリアルへのリンク | pandas チュートリアルはどこでホストされていますか? | https://microsoft.github.io/openaivec/examples/pandas/ でホストされています。 |
| 17 | readme | ベンチマークの概要 | このベンチマークは何を測定していますか? | Series.aio.responses を使用して、100 個の数値文字列を整数リテラルに変換する処理の実行時間を測定しています。 |
| 18 | readme | ベンチマークの概要 | ベンチマークではどのモデルが使用されましたか? | ベンチマークでは gpt-5.1 が使用されました。 |
| 19 | readme | ベンチマークの概要 | このベンチマークの主なポイントは何ですか? | バッチ処理により HTTP のオーバーヘッドの大部分が取り除かれ、さらに並行処理によって総実行時間が短縮されます。 |
| 20 | readme | ベンチマークモード: シリアル | シリアルベンチマークモードを定義する設定は何ですか? | シリアルモードでは batch_size=1 と max_concurrency=1 を使用します。 |
| 21 | readme | ベンチマークモード: シリアル | ベンチマークでシリアルモードにはどれくらい時間がかかりましたか? | 約141秒かかりました。 |
| 22 | readme | ベンチマークモード: バッチ処理 | バッチ処理ベンチマークモードを定義する設定は何ですか? | デフォルトの batch_size と max_concurrency=1 を使用します。 |
| 23 | readme | ベンチマークモード: バッチ処理 | バッチ処理モードにはどれくらい時間がかかりましたか? | 約15秒かかりました。 |
| 24 | readme | ベンチマークモード: 同時バッチ処理 | 同時バッチ処理モードを定義する設定は何ですか? | デフォルトの batch_size とデフォルトの max_concurrency を使用します。 |
| 25 | readme | ベンチマークモード: 同時バッチ処理 | 同時バッチ処理にはどれくらい時間がかかりましたか? | 約6秒かかりました。 |
| 26 | readme | ベンチマークモード: 同時バッチ処理 | なぜ同時バッチ処理はバッチ処理単独より速いのですか? | 並行処理を使ってバッチ化されたリクエストを重ね合わせながら、入力ごとに1つの出力を生成し続けるためです。 |
| 27 | readme | 目次ナビゲーション | このドキュメントではどのような主要トピックが扱われていますか? | プロジェクトの動機、ワークフロー、認証、Spark、プロンプティング、Fabric、コントリビューション、リソース、コミュニティを扱っています。 |
| 28 | readme | 目次ナビゲーション | このドキュメントには pandas と Spark の両方に関するガイダンスが含まれていますか? | はい、pandas と Spark の使用方法および認証について、それぞれ独立したセクションが含まれています。 |
| 29 | readme | なぜ openaivec か? 概要 | なぜ openaivec を選ぶのでしょうか? | 便利な pandas および Spark 統合、最適化されたバッチ処理、キャッシュ、リトライ、推論サポート、再利用可能なタスクおよびプロンプトツールを提供するためです。 |
| 30 | readme | なぜopenaivecなのか? 概要 | openaivecは小規模なローカルデータのタスク専用に設計されていますか? | いいえ、Spark UDFや本番規模のETLシナリオにも対応しています。 |
| 31 | readme | なぜopenaivecなのか?: pandasアクセサ | openaivecにおける.aiと.aioとは何ですか? |
これらは、同期および非同期のAI操作のためのpandasアクセサです。 |
| 32 | readme | なぜopenaivecなのか?: pandasアクセサ | pandasアクセサはなぜ便利なのですか? | AIワークフローを、使い慣れたpandasのパターンの中に保つことができます。 |
| 33 | readme | なぜopenaivecなのか?: バッチ最適化 | BatchCacheとAsyncBatchCacheは何をしますか? |
呼び出しの集約、プロンプトの重複排除、出力順序の維持、失敗時の適切な処理によって、バッチリクエストを最適化します。 |
| 34 | readme | なぜopenaivecなのか?: バッチ最適化 | openaivecはバッチ処理中に出力順序を維持しますか? | はい、出力の元の順序を維持します。 |
| 35 | readme | なぜopenaivecなのか?: バッチ最適化 | バッチ処理が失敗した場合、openaivecはどのように動作しますか? | 上流でエラーが発生した場合でも、待機中の処理を解放します。 |
| 36 | readme | なぜopenaivecなのか?: 推論と構造化出力 | openaivecは推論モデルをサポートしていますか? | はい、OpenAI SDKのセマンティクスを反映した形で推論モデルをサポートしています。 |
| 37 | readme | なぜopenaivecなのか?: 推論と構造化出力 | openaivecは構造化出力を扱えますか? | はい、Pydanticのresponse_formatによる構造化出力をサポートしています。 |
| 38 | readme | なぜopenaivecなのか?: キャッシュとリトライ | openaivecにはキャッシュ機能が含まれていますか? | はい、組み込みのキャッシュ機能が含まれています。 |
| 39 | readme | なぜopenaivecなのか?: キャッシュとリトライ | pandasと非同期ワークフローでキャッシュを共有できますか? | はい、明示的にキャッシュを共有できます。 |
| 40 | readme | なぜ openaivec なのか?: キャッシュとリトライ | Spark は繰り返し入力をどのように処理しますか? | Spark UDF は各パーティション内で繰り返し入力を重複排除します。 |
| 41 | readme | なぜ openaivec なのか?: 本番運用とプロンプトツール | openaivec にはプロンプト構築ツールが含まれていますか? | はい、FewShotPromptBuilder や improve のようなツールが含まれています。 |
| 42 | readme | なぜ openaivec なのか?: 本番運用とプロンプトツール | openaivec にはあらかじめ用意されたタスクがありますか? | はい、厳選されたプロンプトと検証済みの出力を備えたタスクライブラリが含まれています。 |
| 43 | readme | なぜ openaivec なのか?: 本番運用とプロンプトツール | openaivec は本番 ETL ワークフローをサポートできますか? | はい、Spark UDF と Fabric のガイダンスは、ノートブックのワークフローを本番規模の ETL に移行するのに役立つことを意図しています。 |
| 44 | readme | 概要 | ベクトル化された OpenAI バッチ処理とはどういう意味ですか? | これは、入力ごとに 1 回ずつ API リクエストを行うのではなく、複数の入力をまとめて処理することを意味します。 |
| 45 | readme | 概要 | openaivec には特定の Python バージョンが必要ですか? | はい、Python 3.10 以降が必要です。 |
| 46 | readme | 概要 | プロンプトは pandas と async のワークフロー間で再利用できますか? | はい、共有キャッシュヘルパーにより、その両方でプロンプトを再利用できます。 |
| 47 | readme | コアワークフローの概要 | openaivec はどのようなワークフローをサポートしていますか? | 直接 API 利用、pandas 統合、推論モデルの利用、タスクベースのワークフロー、非同期処理、Spark UDF をサポートしています。 |
| 48 | readme | コアワークフローの概要 | openaivec を使う方法は pandas だけですか? | いいえ、直接 API クライアント、非同期アクセサー、Spark UDF ヘルパーも使用できます。 |
| 49 | readme | 直接 API 利用 | pandas を使わずに openaivec を直接使うにはどうすればよいですか? | BatchResponses.of(...) で BatchResponses クライアントを作成し、入力のリストに対して .parse() を呼び出します。 |
| 50 | readme | 直接 API 利用 | なぜ直接 API 利用を選ぶのですか? | バッチクライアントの設定や処理動作を最大限に制御できるためです。 |
| 51 | readme | Direct API Usage | 直接APIの例では、どの設定オプションが示されていますか? | この例では、OpenAIクライアント、モデル名、システムメッセージを設定し、デフォルトの自動バッチサイズを使用しています。 |
| 52 | readme | Direct API Usage: BatchResponses Example | 直接バッチ応答処理にはどのクラスが使われますか? | 直接バッチ応答処理にはBatchResponsesが使われます。 |
| 53 | readme | Direct API Usage: BatchResponses Example | 直接APIの例では、どのモデルが使われていますか? | この例ではgpt-5.1が使われています。 |
| 54 | readme | Direct API Usage: BatchResponses Example | 直接parseの例では、どのような結果が期待されますか? | 期待される結果は['bear family', 'rabbit family', 'koala family']です。 |
| 55 | readme | Direct API Tutorial Link | 直接ワークフローまたはpandasスタイルのワークフロー向けの完全なチュートリアルはありますか? | はい、このドキュメントにはexamplesサイトの完全なチュートリアルへのリンクがあります。 |
| 56 | readme | pandas Authentication Options Overview | pandasの認証はいつ設定すべきですか? | .aiまたは.aioアクセサを使用する前に設定してください。 |
| 57 | readme | pandas Authentication Options Overview | pandasではどのような認証オプションが利用できますか? | OpenAI APIキー、Azure OpenAI APIキー、Entra IDを使用したAzure OpenAI、そしてカスタムクライアント設定です。 |
| 58 | readme | pandas Authentication: OpenAI API Key | pandasでopenaivecをOpenAIに認証するにはどうすればよいですか? | 環境変数にOPENAI_API_KEYを設定してください。 |
| 59 | readme | pandas Authentication: OpenAI API Key | OpenAI認証に使用される環境変数はどれですか? | OPENAI_API_KEYです。 |
| 60 | readme | pandas Authentication: Azure OpenAI API Key | pandasでAzure OpenAI APIキー認証に必要な環境変数は何ですか? | AZURE_OPENAI_API_KEY、AZURE_OPENAI_BASE_URL、AZURE_OPENAI_API_VERSIONです。 |
| 61 | readme | pandas Authentication: Azure OpenAI API Key | /openai/v1/ のAzureベースURLでは、どのAPIバージョンを使うべきですか? |
AZURE_OPENAI_API_VERSION="v1"を使用してください。 |
| 62 | readme | pandas 認証: Azure OpenAI API キー | Azure のベース URL はどのような形式にすべきですか? | https://YOUR-RESOURCE-NAME.services.ai.azure.com/openai/v1/ のような形式にしてください。 |
| 63 | readme | pandas 認証: Entra ID を使用した Azure OpenAI | API キーの代わりに Entra ID で Azure OpenAI を使用するにはどうすればよいですか? | Azure のベース URL と API バージョンを設定し、環境から AZURE_OPENAI_API_KEY を削除します。 |
| 64 | readme | pandas 認証: Entra ID を使用した Azure OpenAI | AZURE_OPENAI_API_KEY が設定されていない場合、openaivec はどの認証資格情報を使用しますか? |
DefaultAzureCredential を使用します。 |
| 65 | readme | pandas 認証: カスタムクライアント | openaivec でカスタム OpenAI クライアントを使用できますか? | はい、カスタムの同期クライアントと非同期クライアントを設定できます。 |
| 66 | readme | pandas 認証: カスタムクライアント | カスタムの同期クライアントを登録するにはどうすればよいですか? | openaivec.set_client(OpenAI()) を呼び出します。 |
| 67 | readme | pandas 認証: カスタムクライアント | カスタムの非同期クライアントを登録するにはどうすればよいですか? | openaivec.set_async_client(AsyncOpenAI()) を呼び出します。 |
| 68 | readme | pandas 統合の概要 | DataFrame で openaivec を使用する推奨方法は何ですか? | 認証とデフォルトモデルの設定後に、.ai.responses() を使った pandas 統合を使用します。 |
| 69 | readme | pandas 統合の概要 | openaivec は AI が生成した列を DataFrame に追加できますか? | はい、df.assign(...) の中で使用して新しい列を作成できます。 |
| 70 | readme | pandas 統合の例 | pandas ワークフロー用のデフォルトの responses モデルを設定するにはどうすればよいですか? | openaivec.set_responses_model("gpt-5.1") を使用します。 |
| 71 | readme | pandas 統合の例 | DataFrame パイプライン内で .ai.responses() はどのように使われますか? |
df.assign(...) の中で Series に対して呼び出し、新しい列を生成できます。 |
| 72 | readme | pandas 統合の例 | 例の出力にはどのような値が表示されていますか? | 出力では、panda は bear family、rabbit は rabbit family、koala は marsupial family に対応付けられています。 |
| 73 | readme | 推論モデルの概要 | openaivec は推論モデルをサポートしていますか? | はい、推論モデルをサポートしており、OpenAI SDK のセマンティクスに従います。 |
| 74 | readme | 推論モデルの概要 | リクエストごとに推論設定を上書きできますか? | はい、reasoning 辞書を渡すことで可能です。 |
| 75 | readme | 推論モデルの概要 | 毎回 reasoning を指定する必要がありますか? |
いいえ、省略してモデルのデフォルト設定を使用できます。 |
| 76 | readme | 推論モデルの例 | openaivec で推論モデルを設定するにはどうすればよいですか? | openaivec.set_responses_model("o1-mini") または他の推論対応モデルを使用してください。 |
| 77 | readme | 推論モデルの例 | reasoning 引数はどのような形式であるべきですか? |
{"effort": "none"} のように、OpenAI SDK のセマンティクスに一致する辞書である必要があります。 |
| 78 | readme | 事前設定済みタスクの概要 | openaivec における事前設定済みタスクとは何ですか? | 感情分析や意図分析のような一般的な操作のための、再利用可能なタスク定義です。 |
| 79 | readme | 事前設定済みタスクの概要 | 生のプロンプトではなくタスクを使う理由は何ですか? | タスクは一般的なワークフローを簡素化し、検証済みで構造化された出力を提供できる場合があります。 |
| 80 | readme | 事前設定済みタスクの例 | pandas の列に対して事前定義されたタスクを実行するにはどうすればよいですか? | nlp.sentiment_analysis() のようなタスクオブジェクトを使って .ai.task(...) を呼び出してください。 |
| 81 | readme | 事前設定済みタスクの例 | 例ではどのタスクカテゴリが示されていますか? | 例では、NLP の感情分析とカスタマーサポートの意図分析が示されています。 |
| 82 | readme | 事前設定済みタスクの例 | 構造化されたタスク結果を列に抽出するにはどうすればよいですか? | 結果に対して .ai.extract("sentiment") または別のフィールド名を使用してください。 |
| 83 | readme | 非同期処理の概要 | openaivec における .aio とは何ですか? |
.aio は、pandas オブジェクトに対する AI 操作のための非同期アクセサです。 |
| 84 | readme | 非同期処理の概要 | .ai ではなく .aio を使うべきなのはいつですか? |
高スループットまたは、並行処理によって性能が向上する非同期ワークフローでは .aio を使用してください。 |
| 85 | readme | 非同期処理の例 | pandas の Series に対して非同期レスポンス生成を実行するにはどうすればよいですか? | 非同期関数の中で await series.aio.responses(...) を使用してください。 |
| 86 | readme | 非同期処理の例 | 通常の Python コードから非同期ワークフローはどのように実行されますか? | この例では asyncio.run(process_data()) を使用しています。 |
| 87 | readme | 非同期処理の例 | max_concurrency=12 は何をしますか? |
非同期ワークフローで最大 12 件のリクエストを同時に実行できるようにします。 |
| 88 | readme | 非同期処理の利点 | .aio 処理の利点は何ですか? |
並列処理、バッチ処理、重複排除、レート制限、エラーハンドリング、メモリ効率の高いストリーミングを提供します。 |
| 89 | readme | 非同期処理の利点 | 非同期処理は大規模データセットに役立ちますか? | はい。高スループットかつ大規模データのワークロード向けに設計されています。 |
| 90 | readme | Apache Spark UDF の概要 | openaivec は Apache Spark で使用できますか? | はい。ヘルパー関数と UDF ビルダーを通じて Apache Spark をサポートしています。 |
| 91 | readme | Apache Spark UDF の概要 | Spark セクションの目的は何ですか? | Spark UDF を使用して、分散データセットに openaivec のワークフローをスケールさせる方法を説明しています。 |
| 92 | readme | Spark チュートリアルへのリンク | openaivec 用の Spark チュートリアルはありますか? | はい、Spark チュートリアルがオンラインで利用できます。 |
| 93 | readme | Spark チュートリアルへのリンク | Spark チュートリアルはどこにありますか? | https://microsoft.github.io/openaivec/examples/spark/ にあります。 |
| 94 | readme | Spark 認証オプションの概要 | Spark で利用可能な認証オプションは何ですか? | OpenAI API キー、Azure OpenAI API キー、そして Entra ID を使用した Azure OpenAI です。 |
| 95 | readme | Spark 認証オプションの概要 | Spark の認証設定はいつ行うべきですか? | UDF を登録して使用する前に設定する必要があります。 |
| 96 | readme | Spark 認証: OpenAI API キー | OpenAI API キー認証用に Spark を設定するにはどうすればよいですか? | setup(spark, api_key=..., responses_model_name=..., embeddings_model_name=...) を呼び出します。 |
| 97 | readme | Spark 認証: OpenAI API キー | OpenAI の Spark 設定例では、どのモデル設定が指定されていますか? | responses_model_name="gpt-5.1" と embeddings_model_name="text-embedding-3-small" が設定されています。 |
| 98 | readme | Spark 認証: Azure OpenAI API キー | API キーを使って Azure OpenAI 用に Spark を設定するにはどうすればよいですか? | Spark セッション、API キー、ベース URL、API バージョン、デプロイ名を指定して setup_azure(...) を使用します。 |
| 99 | readme | Spark 認証: Azure OpenAI API キー | Azure の Spark 設定では、デプロイ名とモデル名のどちらを使うべきですか? | この例では my-gpt-deployment や my-embedding-deployment のようなデプロイ名を使用しています。 |
| 100 | readme | Spark 認証: Azure OpenAI API キー | 必要な Azure の URL とバージョンの形式は何ですか? | /openai/v1/ で終わるベース URL と api_version="v1" を使用します。 |
| 101 | readme | Spark 認証: Entra ID を使用した Azure OpenAI | Spark のシナリオで Entra ID を使って Azure OpenAI を利用するにはどうすればよいですか? | Azure の環境変数を設定し、API キーを解除して、DefaultAzureCredential を利用します。 |
| 102 | readme | Spark 認証: Entra ID を使用した Azure OpenAI | AZURE_OPENAI_API_KEY が未設定の場合はどうなりますか? |
openaivec は DefaultAzureCredential を使用します。 |
| 103 | readme | Spark UDF の登録 | レスポンスベースの Spark UDF を登録するにはどうすればよいですか? | responses_udf(...) のようなヘルパーとともに spark.udf.register(...) を使用します。 |
| 104 | readme | Spark UDF の登録 | extract_brand の例は何をしますか? |
商品説明からブランド名だけを抽出します。 |
| 105 | readme | Spark UDF の登録 | Spark UDF ヘルパーに推論設定を渡すことはできますか? | はい。例では reasoning={"effort": "none"} を渡しています。 |
| 106 | readme | Spark UDF の使用例 | 登録済みの openaivec Spark UDF をクエリ内で使用するにはどうすればよいですか? | selectExpr("product_name", "extract_brand(product_name) AS brand") のような Spark SQL 式で使用します。 |
| 107 | readme | Spark UDF の使用例 | ブランド抽出 UDF のサンプル入力として何が示されていますか? | Nike Air Max と Apple iPhone 15 です。 |
| 108 | readme | その他のSparkヘルパーUDF | 他に利用可能なSparkヘルパーUDFは何ですか? | task_udf、embeddings_udf、count_tokens_udf、similarity_udf、parse_udf です。 |
| 109 | readme | その他のSparkヘルパーUDF | openaivecはSparkの埋め込みと類似度演算をサポートしていますか? | はい、埋め込みと類似度のためのヘルパーUDFが提供されています。 |
| 110 | readme | Sparkパフォーマンスのヒント | openaivecはどのようにSpark UDFのパフォーマンスを最適化しますか? | パーティションごとに繰り返される入力を重複排除し、バッチ処理と同時実行性の調整をサポートします。 |
| 111 | readme | Sparkパフォーマンスのヒント | Sparkにおけるbatch_sizeの推奨デフォルト値は何ですか? |
固定サイズが必要でない限り、自動最適化のために batch_size=None を使用してください。 |
| 112 | readme | Sparkパフォーマンスのヒント | 手動で調整する場合、どの固定batch_sizeの範囲が推奨されますか? |
32から128の範囲が推奨されます。 |
| 113 | readme | Sparkパフォーマンスのヒント | Sparkにおけるmax_concurrencyはどのように考えればよいですか? |
これはエグゼキューターごとの値なので、合計の同時実行数はエグゼキューター数 × max_concurrency になります。 |
| 114 | readme | Sparkパフォーマンスのヒント | 推奨される初期max_concurrencyは何ですか? |
4から12で始めてください。 |
| 115 | readme | Sparkパフォーマンスのヒント | Sparkの同時実行性を調整する際、どの外部制約を監視すべきですか? | OpenAIの利用ティアに基づくレート制限を監視する必要があります。 |
| 116 | readme | プロンプト構築の概要 | openaivecはプロンプト設計に役立ちますか? | はい、プロンプトの構築と改善のために FewShotPromptBuilder と improve() が含まれています。 |
| 117 | readme | プロンプト構築の概要 | なぜfew-shotプロンプトを使うのですか? | few-shotプロンプトは、より明確な例と指示を与えることで、LLMの出力品質を向上させることができます。 |
| 118 | readme | FewShotPromptBuilder の例 | openaivecでfew-shotプロンプトを作成するにはどうすればよいですか? | FewShotPromptBuilder() を使用し、.purpose()、.caution()、.example()、.improve()、.build() のようなメソッドをチェーンしてください。 |
| 119 | readme | FewShotPromptBuilder の例 | .improve(max_iter=1) は何をしますか? |
これは、OpenAIを使用して、プロンプトを1回の反復で任意に改善します。 |
| 120 | readme | FewShotPromptBuilder の例 | プロンプトビルダーのサンプルでは、どのような例が示されていますか? | Apple -> Fruit と Car -> Vehicle です。 |
| 121 | readme | 高度なプロンプティングのチュートリアルリンク | 高度なプロンプティングのチュートリアルはありますか? | はい、ドキュメントにそのリンクがあります。 |
| 122 | readme | 高度なプロンプティングのチュートリアルリンク | openaivec を使ったプロンプティングについて、どこで詳しく学べますか? | https://microsoft.github.io/openaivec/examples/prompt/ で学べます。 |
| 123 | readme | Microsoft Fabric の概要 | openaivec は Microsoft Fabric で使用できますか? | はい、Fabric 環境で PyPI からインストールし、Spark ノートブックで使用できます。 |
| 124 | readme | Microsoft Fabric の概要 | Microsoft Fabric で openaivec を使うにはどうすればよいですか? | PyPI から Fabric 環境に追加し、ノートブックでその環境を選択して、標準の Spark と同様に openaivec.spark を使用します。 |
| 125 | readme | コントリビューションの概要 | このプロジェクトはコントリビューションを受け付けていますか? | はい、コントリビューションは歓迎されています。 |
| 126 | readme | コントリビューションの概要 | コントリビューターはどのブランチから始めるべきですか? | main からフォークしてブランチを作成する必要があります。 |
| 127 | readme | コントリビューションの概要 | コードを変更する際、コントリビューターはテストを更新すべきですか? | はい、必要に応じてテストを追加または更新するべきです。 |
| 128 | readme | コントリビューションの概要 | PR を開く前に何をすべきですか? | プルリクエストを開く前に、フォーマットとテストを実行してください。 |
| 129 | readme | コントリビューション: 開発用依存関係のインストール | 開発用依存関係をインストールするにはどうすればよいですか? | uv sync --all-extras --dev を実行してください。 |
| 130 | readme | コントリビューション: Lint とフォーマット | コードベースを lint してフォーマットするにはどうすればよいですか? | uv run ruff check . --fix を実行してください。 |
| 131 | readme | コントリビューション: Lint とフォーマット | この例では、lint とフォーマットにどのツールが使われていますか? | 提示されたコマンドでは Ruff が使用されています。 |
| 132 | readme | 貢献: テストコマンド | 推奨されている簡易テストスイートはどのように実行すればよいですか? | uv run pytest -m "not slow and not requires_api" を実行してください。 |
| 133 | readme | 貢献: テストコマンド | 簡易テストコマンドではどの種類のテストが除外されますか? | slow および requires_api とマークされたテストは除外されます。 |
| 134 | readme | 追加リソースの概要 | このプロジェクトでは追加のチュートリアルや例を提供していますか? | はい、複数のチュートリアルやユースケース例へのリンクがあります。 |
| 135 | readme | 追加リソースの概要 | どのような種類のサンプルプロジェクトがありますか? | 例には、顧客フィードバック分析、アンケート変換、非同期ワークフロー、FAQ生成、およびチュートリアルの完全なコレクションが含まれます。 |
| 136 | readme | 追加リソース: 顧客フィードバック分析 | 顧客フィードバックを分析するための例はありますか? | はい、感情分析と優先順位付けを扱うチュートリアルがあります。 |
| 137 | readme | 追加リソース: 顧客フィードバック分析 | 顧客フィードバック分析の例はどこで見つけられますか? | https://microsoft.github.io/openaivec/examples/customer_analysis/ にあります。 |
| 138 | readme | 追加リソース: アンケートデータ変換 | アンケートデータ変換の例はありますか? | はい、非構造化アンケートデータを構造化データに変換するためのチュートリアルがあります。 |
| 139 | readme | 追加リソース: アンケートデータ変換 | アンケート変換チュートリアルはどこにありますか? | https://microsoft.github.io/openaivec/examples/survey_transformation/ にあります。 |
| 140 | readme | 追加リソース: 非同期処理の例 | 専用の非同期ワークフロー例はありますか? | はい、このドキュメントには非同期処理の例へのリンクがあります。 |
| 141 | readme | 追加リソース: 非同期処理の例 | 非同期処理の例はどこで見つけられますか? | https://microsoft.github.io/openaivec/examples/aio/ にあります。 |
| 142 | readme | 追加リソース: FAQ生成 | ドキュメントからFAQを生成する例はありますか? | はい、AIを使ってFAQを自動生成するチュートリアルがあります。 |
| 143 | readme | 追加リソース: FAQ生成 | FAQ生成の例はどこにありますか? | https://microsoft.github.io/openaivec/examples/generate_faq/ にあります。 |
| 144 | readme | 追加リソース: すべての例 | openaivec のすべての例はどこで閲覧できますか? | ドキュメントでリンクされている https://microsoft.github.io/openaivec/examples/pandas/ にあります。 |
| 145 | readme | 追加リソース:すべての例 | チュートリアルの一元的なコレクションはありますか? | はい、このドキュメントにはチュートリアルとユースケースの完全なコレクションへのリンクがあります。 |
| 146 | readme | コミュニティ | openaivecユーザー向けのコミュニティはありますか? | はい、Discordコミュニティがあります。 |
| 147 | readme | コミュニティ | コミュニティのリンクは何ですか? | Discordのリンクは https://discord.gg/hXCS9J6Qek です。 |
| 148 | readme | コミュニティ | Discordコミュニティは何のために使われていますか? | サポートとお知らせのために使われています。 |