update documentation part3 - add code examples (#2369)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@ from skyvern.forge.sdk.core.security import generate_skyvern_signature
|
||||
from skyvern.forge.sdk.db.enums import OrganizationAuthTokenType
|
||||
from skyvern.forge.sdk.executor.factory import AsyncExecutorFactory
|
||||
from skyvern.forge.sdk.models import Step
|
||||
from skyvern.forge.sdk.routes.code_samples import GET_RUN_CODE_SAMPLE, RUN_TASK_CODE_SAMPLE, RUN_WORKFLOW_CODE_SAMPLE
|
||||
from skyvern.forge.sdk.routes.routers import base_router, legacy_base_router, legacy_v2_router
|
||||
from skyvern.forge.sdk.schemas.ai_suggestions import AISuggestionBase, AISuggestionRequest
|
||||
from skyvern.forge.sdk.schemas.organizations import (
|
||||
@@ -417,6 +418,7 @@ async def get_runs(
|
||||
openapi_extra={
|
||||
"x-fern-sdk-group-name": "agent",
|
||||
"x-fern-sdk-method-name": "get_run",
|
||||
"x-fern-examples": [{"code-samples": [{"sdk": "python", "code": GET_RUN_CODE_SAMPLE}]}],
|
||||
},
|
||||
responses={
|
||||
200: {"description": "Successfully got run"},
|
||||
@@ -1423,6 +1425,16 @@ async def _flatten_workflow_run_timeline(organization_id: str, workflow_run_id:
|
||||
openapi_extra={
|
||||
"x-fern-sdk-group-name": "agent",
|
||||
"x-fern-sdk-method-name": "run_task",
|
||||
"x-fern-examples": [
|
||||
{
|
||||
"code-samples": [
|
||||
{
|
||||
"sdk": "python",
|
||||
"code": RUN_TASK_CODE_SAMPLE,
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
description="Run a task",
|
||||
summary="Run a task",
|
||||
@@ -1582,6 +1594,16 @@ async def run_task(
|
||||
openapi_extra={
|
||||
"x-fern-sdk-group-name": "agent",
|
||||
"x-fern-sdk-method-name": "run_workflow",
|
||||
"x-fern-examples": [
|
||||
{
|
||||
"code-samples": [
|
||||
{
|
||||
"sdk": "python",
|
||||
"code": RUN_WORKFLOW_CODE_SAMPLE,
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
description="Run a workflow",
|
||||
summary="Run a workflow",
|
||||
|
||||
18
skyvern/forge/sdk/routes/code_samples.py
Normal file
18
skyvern/forge/sdk/routes/code_samples.py
Normal file
@@ -0,0 +1,18 @@
|
||||
RUN_TASK_CODE_SAMPLE = """from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(api_key="your_api_key")
|
||||
await client.run_task(prompt="What's the top post on hackernews?")
|
||||
"""
|
||||
|
||||
GET_RUN_CODE_SAMPLE = """from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(api_key="your_api_key")
|
||||
run = await client.get_run(run_id="tsk_123")
|
||||
print(run)
|
||||
"""
|
||||
|
||||
RUN_WORKFLOW_CODE_SAMPLE = """from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(api_key="your_api_key")
|
||||
await client.agent.run_workflow(workflow_id="wpid_123", parameters={"parameter1": "value1", "parameter2": "value2"})
|
||||
"""
|
||||
@@ -92,7 +92,7 @@ class CredentialItem(BaseModel):
|
||||
class CreateCredentialRequest(BaseModel):
|
||||
"""Request model for creating a new credential."""
|
||||
|
||||
name: str = Field(..., description="Name of the credential", examples=["My Credential"])
|
||||
name: str = Field(..., description="Name of the credential", examples=["Amazon Login"])
|
||||
credential_type: CredentialType = Field(..., description="Type of credential to create")
|
||||
credential: NonEmptyPasswordCredential | NonEmptyCreditCardCredential = Field(
|
||||
...,
|
||||
@@ -109,7 +109,7 @@ class CredentialResponse(BaseModel):
|
||||
..., description="The credential data"
|
||||
)
|
||||
credential_type: CredentialType = Field(..., description="Type of the credential")
|
||||
name: str = Field(..., description="Name of the credential", examples=["My Credential"])
|
||||
name: str = Field(..., description="Name of the credential", examples=["Amazon Login"])
|
||||
|
||||
|
||||
class Credential(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user