code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
async def create_term(
agent_id: TermAgentIdPath,
params: LegacyTermCreationParamsDTO,
) -> LegacyTermDTO:
"""
[DEPRECATED] Creates a new term in the agent's glossary.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-bas... |
[DEPRECATED] Creates a new term in the agent's glossary.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
This endpoint will be removed in a future release.
The term will be initialized with the provided ... | create_term | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def read_term(
agent_id: TermAgentIdPath,
term_id: TermIdPath,
) -> LegacyTermDTO:
"""
[DEPRECATED] Retrieves details of a specific term by ID for a given agent.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-bas... |
[DEPRECATED] Retrieves details of a specific term by ID for a given agent.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
This endpoint will be removed in a future release.
| read_term | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def list_terms(
agent_id: TermAgentIdPath,
) -> Sequence[LegacyTermDTO]:
"""
[DEPRECATED] Retrieves a list of all terms in the agent's glossary.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
... |
[DEPRECATED] Retrieves a list of all terms in the agent's glossary.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
This endpoint will be removed in a future release.
Returns an empty list if no terms as... | list_terms | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
def from_dto(dto: LegacyTermUpdateParamsDTO) -> TermUpdateParams:
"""
[DEPRECATED] Updates an existing term's attributes in the agent's glossary.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
... |
[DEPRECATED] Updates an existing term's attributes in the agent's glossary.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
This endpoint will be removed in a future release.
Only the... | from_dto | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def delete_term(
agent_id: TermAgentIdPath,
term_id: TermIdPath,
) -> None:
"""
[DEPRECATED] Deletes a term from the agent.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
This en... |
[DEPRECATED] Deletes a term from the agent.
This endpoint uses the deprecated agent_id approach instead of tags.
Consider using the new tag-based endpoints instead.
This endpoint will be removed in a future release.
Deleting a non-existent term will return 404.
No con... | delete_term | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def create_term(
params: TermCreationParamsDTO,
) -> TermDTO:
"""
Creates a new term in the glossary.
The term will be initialized with the provided name and description, and optional synonyms.
A unique identifier will be automatically generated.
Default behav... |
Creates a new term in the glossary.
The term will be initialized with the provided name and description, and optional synonyms.
A unique identifier will be automatically generated.
Default behaviors:
- `synonyms` defaults to an empty list if not provided
| create_term | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def read_term(
term_id: TermIdPath,
) -> TermDTO:
"""
Retrieves details of a specific term by ID.
"""
term = await glossary_store.read_term(term_id=term_id)
return TermDTO(
id=term.id,
name=term.name,
description=term.descrip... |
Retrieves details of a specific term by ID.
| read_term | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def list_terms(
tag_id: TagIdQuery = None,
) -> Sequence[TermDTO]:
"""
Retrieves a list of all terms in the glossary.
Returns an empty list if no terms exist.
Terms are returned in no guaranteed order.
"""
if tag_id:
terms = await glossary_s... |
Retrieves a list of all terms in the glossary.
Returns an empty list if no terms exist.
Terms are returned in no guaranteed order.
| list_terms | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def update_term(
term_id: TermIdPath,
params: TermUpdateParamsDTO,
) -> TermDTO:
"""
Updates an existing term's attributes in the glossary.
Only the provided attributes will be updated; others will remain unchanged.
The term's ID and creation timestamp cannot b... |
Updates an existing term's attributes in the glossary.
Only the provided attributes will be updated; others will remain unchanged.
The term's ID and creation timestamp cannot be modified.
| update_term | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
async def delete_term(
term_id: TermIdPath,
) -> None:
"""
Deletes a term from the glossary.
Deleting a non-existent term will return 404.
No content will be returned from a successful deletion.
"""
await glossary_store.delete_term(term_id=term_id) |
Deletes a term from the glossary.
Deleting a non-existent term will return 404.
No content will be returned from a successful deletion.
| delete_term | python | emcie-co/parlant | src/parlant/api/glossary.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/glossary.py | Apache-2.0 |
def create_legacy_router(
application: Application,
guideline_store: GuidelineStore,
tag_store: TagStore,
relationship_store: RelationshipStore,
service_registry: ServiceRegistry,
guideline_tool_association_store: GuidelineToolAssociationStore,
) -> APIRouter:
"""
DEPRECATED: This router... |
DEPRECATED: This router uses agent-based paths which are being phased out.
Use the tag-based API instead.
| create_legacy_router | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def create_guidelines(
agent_id: agents.AgentIdPath,
params: LegacyGuidelineCreationParamsDTO,
) -> LegacyGuidelineCreationResult:
"""
DEPRECATED: Use the tag-based API instead.
Creates new guidelines from the provided invoices.
Invoices are obtained by callin... |
DEPRECATED: Use the tag-based API instead.
Creates new guidelines from the provided invoices.
Invoices are obtained by calling the `create_evaluation` method of the client.
(Equivalent to making a POST request to `/index/evaluations`)
See the [documentation](https://parlant.io... | create_guidelines | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def read_guideline(
agent_id: agents.AgentIdPath,
guideline_id: GuidelineIdPath,
) -> LegacyGuidelineWithConnectionsAndToolAssociationsDTO:
"""
DEPRECATED: Use the tag-based API instead.
Retrieves a specific guideline with all its connections and tool associations.
... |
DEPRECATED: Use the tag-based API instead.
Retrieves a specific guideline with all its connections and tool associations.
Returns both direct and indirect connections between guidelines.
Tool associations indicate which tools the guideline can use.
| read_guideline | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def list_guidelines(
agent_id: agents.AgentIdPath,
) -> Sequence[LegacyGuidelineDTO]:
"""
DEPRECATED: Use the tag-based API instead.
Lists all guidelines for the specified agent.
Returns an empty list if no guidelines exist.
Guidelines are returned in no guara... |
DEPRECATED: Use the tag-based API instead.
Lists all guidelines for the specified agent.
Returns an empty list if no guidelines exist.
Guidelines are returned in no guaranteed order.
Does not include connections or tool associations.
| list_guidelines | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def update_guideline(
agent_id: agents.AgentIdPath,
guideline_id: GuidelineIdPath,
params: LegacyGuidelineUpdateParamsDTO,
) -> LegacyGuidelineWithConnectionsAndToolAssociationsDTO:
"""
DEPRECATED: Use the tag-based API instead.
Updates a guideline's connection... |
DEPRECATED: Use the tag-based API instead.
Updates a guideline's connections and tool associations.
Only provided attributes will be updated; others remain unchanged.
Connection rules:
- A guideline cannot connect to itself
- Only direct connections can be removed
... | update_guideline | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def delete_guideline(
agent_id: agents.AgentIdPath,
guideline_id: GuidelineIdPath,
) -> None:
"""
DEPRECATED: Use the tag-based API instead.
Deletes a guideline from the agent.
Also removes all associated connections and tool associations.
Deleting a n... |
DEPRECATED: Use the tag-based API instead.
Deletes a guideline from the agent.
Also removes all associated connections and tool associations.
Deleting a non-existent guideline will return 404.
No content will be returned from a successful deletion.
| delete_guideline | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
def create_router(
guideline_store: GuidelineStore,
relationship_store: RelationshipStore,
service_registry: ServiceRegistry,
guideline_tool_association_store: GuidelineToolAssociationStore,
agent_store: AgentStore,
tag_store: TagStore,
journey_store: JourneyStore,
) -> APIRouter:
"""Cre... | Creates a router for the guidelines API with tag-based paths. | create_router | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def create_guideline(
params: GuidelineCreationParamsDTO,
) -> GuidelineDTO:
"""
Creates a new guideline.
See the [documentation](https://parlant.io/docs/concepts/customization/guidelines) for more information.
"""
tags = []
if params.tags:
... |
Creates a new guideline.
See the [documentation](https://parlant.io/docs/concepts/customization/guidelines) for more information.
| create_guideline | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def list_guidelines(
tag_id: TagIdQuery = None,
) -> Sequence[GuidelineDTO]:
"""
Lists all guidelines for the specified tag or all guidelines if no tag is provided.
Returns an empty list if no guidelines exist.
Guidelines are returned in no guaranteed order.
Do... |
Lists all guidelines for the specified tag or all guidelines if no tag is provided.
Returns an empty list if no guidelines exist.
Guidelines are returned in no guaranteed order.
Does not include relationships or tool associations.
| list_guidelines | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def read_guideline(
guideline_id: GuidelineIdPath,
) -> GuidelineWithRelationshipsAndToolAssociationsDTO:
"""
Retrieves a specific guideline with all its relationships and tool associations.
Returns both direct and indirect relationships between guidelines.
Tool associ... |
Retrieves a specific guideline with all its relationships and tool associations.
Returns both direct and indirect relationships between guidelines.
Tool associations indicate which tools the guideline can use.
| read_guideline | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def update_guideline(
guideline_id: GuidelineIdPath,
params: GuidelineUpdateParamsDTO,
) -> GuidelineWithRelationshipsAndToolAssociationsDTO:
"""Updates a guideline's relationships and tool associations.
Only provided attributes will be updated; others remain unchanged.
... | Updates a guideline's relationships and tool associations.
Only provided attributes will be updated; others remain unchanged.
Relationship rules:
- A guideline cannot relate to itself
- Only direct relationships can be removed
- The relationship must specify this guideline as s... | update_guideline | python | emcie-co/parlant | src/parlant/api/guidelines.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/guidelines.py | Apache-2.0 |
async def create_evaluation(
params: LegacyEvaluationCreationParamsDTO,
) -> LegacyEvaluationDTO:
"""
Creates a new evaluation task for the specified agent.
An evaluation analyzes proposed changes (payloads) to an agent's guidelines
to ensure coherence and consistency with e... |
Creates a new evaluation task for the specified agent.
An evaluation analyzes proposed changes (payloads) to an agent's guidelines
to ensure coherence and consistency with existing guidelines and the agent's
configuration. This helps maintain predictable agent behavior by detecting
... | create_evaluation | python | emcie-co/parlant | src/parlant/api/index.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/index.py | Apache-2.0 |
async def create_journey(
params: JourneyCreationParamsDTO,
) -> JourneyDTO:
"""
Creates a new journey in the system.
The journey will be initialized with the provided title, description, and conditions.
A unique identifier will be automatically generated.
"""
... |
Creates a new journey in the system.
The journey will be initialized with the provided title, description, and conditions.
A unique identifier will be automatically generated.
| create_journey | python | emcie-co/parlant | src/parlant/api/journeys.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/journeys.py | Apache-2.0 |
async def list_journeys(
tag_id: TagIdQuery = None,
) -> Sequence[JourneyDTO]:
"""
Retrieves a list of all journeys in the system.
"""
if tag_id:
journeys = await journey_store.list_journeys(
tags=[tag_id],
)
else:
j... |
Retrieves a list of all journeys in the system.
| list_journeys | python | emcie-co/parlant | src/parlant/api/journeys.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/journeys.py | Apache-2.0 |
async def read_journey(
journey_id: JourneyIdPath,
) -> JourneyDTO:
"""
Retrieves details of a specific journey by ID.
"""
journey = await journey_store.read_journey(journey_id=journey_id)
return JourneyDTO(
id=journey.id,
title=journey.title,... |
Retrieves details of a specific journey by ID.
| read_journey | python | emcie-co/parlant | src/parlant/api/journeys.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/journeys.py | Apache-2.0 |
async def update_journey(
journey_id: JourneyIdPath,
params: JourneyUpdateParamsDTO,
) -> JourneyDTO:
"""
Updates an existing journey's attributes.
Only the provided attributes will be updated; others will remain unchanged.
"""
journey = await journey_store.r... |
Updates an existing journey's attributes.
Only the provided attributes will be updated; others will remain unchanged.
| update_journey | python | emcie-co/parlant | src/parlant/api/journeys.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/journeys.py | Apache-2.0 |
async def delete_journey(
journey_id: JourneyIdPath,
) -> None:
"""
Deletes a journey from the system.
Also deletes the associated guideline.
Deleting a non-existent journey will return 404.
No content will be returned from a successful deletion.
"""
... |
Deletes a journey from the system.
Also deletes the associated guideline.
Deleting a non-existent journey will return 404.
No content will be returned from a successful deletion.
| delete_journey | python | emcie-co/parlant | src/parlant/api/journeys.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/journeys.py | Apache-2.0 |
async def create_relationship(
params: RelationshipCreationParamsDTO,
) -> RelationshipDTO:
"""
Create a relationship.
A relationship is a relationship between a guideline and a tag.
It can be created between a guideline and a tag, or between two guidelines, or between two t... |
Create a relationship.
A relationship is a relationship between a guideline and a tag.
It can be created between a guideline and a tag, or between two guidelines, or between two tags.
| create_relationship | python | emcie-co/parlant | src/parlant/api/relationships.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/relationships.py | Apache-2.0 |
async def list_relationships(
kind: Optional[RelationshipKindQuery] = None,
indirect: IndirectQuery = True,
guideline_id: Optional[GuidelineIdQuery] = None,
tag_id: Optional[TagIdQuery] = None,
tool_id: Optional[ToolIdQuery] = None,
) -> Sequence[RelationshipDTO]:
"""... |
List relationships.
Either `guideline_id` or `tag_id` or `tool_id` must be provided.
| list_relationships | python | emcie-co/parlant | src/parlant/api/relationships.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/relationships.py | Apache-2.0 |
def create_router(service_registry: ServiceRegistry) -> APIRouter:
"""
Creates a router instance for service-related operations.
The router provides endpoints for managing service integrations,
including both SDK and OpenAPI based services. It handles service
registration, updates, and querying ava... |
Creates a router instance for service-related operations.
The router provides endpoints for managing service integrations,
including both SDK and OpenAPI based services. It handles service
registration, updates, and querying available tools.
| create_router | python | emcie-co/parlant | src/parlant/api/services.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/services.py | Apache-2.0 |
async def delete_service(
name: ServiceNamePath,
) -> None:
"""
Removes a service integration.
Effects:
- Active connections are terminated immediately
- Service tools become unavailable to agents
- Historical data about tool usage is preserved
- Runn... |
Removes a service integration.
Effects:
- Active connections are terminated immediately
- Service tools become unavailable to agents
- Historical data about tool usage is preserved
- Running operations may fail
| delete_service | python | emcie-co/parlant | src/parlant/api/services.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/services.py | Apache-2.0 |
async def read_service(
name: ServiceNamePath,
) -> ServiceDTO:
"""
Get details about a specific service including all its tools.
The response includes:
- Basic service information (name, kind, URL)
- Complete list of available tools
- Parameter definitions f... |
Get details about a specific service including all its tools.
The response includes:
- Basic service information (name, kind, URL)
- Complete list of available tools
- Parameter definitions for each tool
Notes:
- Tools list may be empty if service is still init... | read_service | python | emcie-co/parlant | src/parlant/api/services.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/services.py | Apache-2.0 |
async def create_session(
params: SessionCreationParamsDTO,
allow_greeting: AllowGreetingQuery = True,
) -> SessionDTO:
"""Creates a new session between an agent and customer.
The session will be initialized with the specified agent and optional customer.
If no customer_id i... | Creates a new session between an agent and customer.
The session will be initialized with the specified agent and optional customer.
If no customer_id is provided, a guest customer will be created.
| create_session | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def read_session(
session_id: SessionIdPath,
) -> SessionDTO:
"""Retrieves details of a specific session by ID."""
session = await session_store.read_session(session_id=session_id)
return SessionDTO(
id=session.id,
agent_id=session.agent_id,
... | Retrieves details of a specific session by ID. | read_session | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def list_sessions(
agent_id: Optional[AgentIdQuery] = None,
customer_id: Optional[CustomerIdQuery] = None,
) -> Sequence[SessionDTO]:
"""Lists all sessions matching the specified filters.
Can filter by agent_id and/or customer_id. Returns all sessions if no
filters are... | Lists all sessions matching the specified filters.
Can filter by agent_id and/or customer_id. Returns all sessions if no
filters are provided. | list_sessions | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def delete_session(
session_id: SessionIdPath,
) -> None:
"""Deletes a session and all its associated events.
The operation is idempotent - deleting a non-existent session will return 404."""
await session_store.read_session(session_id)
await session_store.delete_sess... | Deletes a session and all its associated events.
The operation is idempotent - deleting a non-existent session will return 404. | delete_session | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def delete_sessions(
agent_id: Optional[AgentIdQuery] = None,
customer_id: Optional[CustomerIdQuery] = None,
) -> None:
"""Deletes all sessions matching the specified filters.
Can filter by agent_id and/or customer_id. Will delete all sessions if no
filters are provide... | Deletes all sessions matching the specified filters.
Can filter by agent_id and/or customer_id. Will delete all sessions if no
filters are provided. | delete_sessions | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def update_session(
session_id: SessionIdPath,
params: SessionUpdateParamsDTO,
) -> SessionDTO:
"""Updates an existing session's attributes.
Only provided attributes will be updated; others remain unchanged."""
async def from_dto(dto: SessionUpdateParamsDTO) -> Sessio... | Updates an existing session's attributes.
Only provided attributes will be updated; others remain unchanged. | update_session | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def create_event(
session_id: SessionIdPath,
params: EventCreationParamsDTO,
moderation: ModerationQuery = Moderation.NONE,
) -> EventDTO:
"""Creates a new event in the specified session.
Currently supports creating message events from customer and human agent sources.... | Creates a new event in the specified session.
Currently supports creating message events from customer and human agent sources. | create_event | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def list_events(
session_id: SessionIdPath,
min_offset: Optional[MinOffsetQuery] = None,
source: Optional[EventSourceDTO] = None,
correlation_id: Optional[CorrelationIdQuery] = None,
kinds: Optional[KindsQuery] = None,
wait_for_data: int = 60,
) -> Sequence[Even... | Lists events from a session with optional filtering and waiting capabilities.
This endpoint retrieves events from a specified session and can:
1. Filter events by their offset, source, type, and correlation ID
2. Wait for new events to arrive if requested
3. Return events in chronologic... | list_events | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def delete_events(
session_id: SessionIdPath,
min_offset: MinOffsetQuery,
) -> None:
"""Deletes events from a session with offset >= the specified value.
This operation is permanent and cannot be undone."""
events = await session_store.list_events(
session... | Deletes events from a session with offset >= the specified value.
This operation is permanent and cannot be undone. | delete_events | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def inspect_event(
session_id: SessionIdPath,
event_id: EventIdPath,
) -> EventInspectionResult:
"""Retrieves detailed inspection information about an event.
For AI agent message events, includes information about message generation,
tool calls, and preparation iterati... | Retrieves detailed inspection information about an event.
For AI agent message events, includes information about message generation,
tool calls, and preparation iterations. | inspect_event | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def _find_correlated_tool_calls(
session_id: SessionIdPath,
event: Event,
) -> Sequence[ToolCallDTO]:
"""Helper function to find tool calls correlated with an event."""
tool_events = await session_store.list_events(
session_id=session_id,
kinds=[EventKi... | Helper function to find tool calls correlated with an event. | _find_correlated_tool_calls | python | emcie-co/parlant | src/parlant/api/sessions.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/sessions.py | Apache-2.0 |
async def create_tag(
params: TagCreationParamsDTO,
) -> TagDTO:
"""
Creates a new tag with the specified name.
The tag ID is automatically generated and the creation timestamp is set to the current time.
Tag names must be unique and follow the kebab-case format.
"""... |
Creates a new tag with the specified name.
The tag ID is automatically generated and the creation timestamp is set to the current time.
Tag names must be unique and follow the kebab-case format.
| create_tag | python | emcie-co/parlant | src/parlant/api/tags.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/tags.py | Apache-2.0 |
async def read_tag(
tag_id: TagIdPath,
) -> TagDTO:
"""
Retrieves details of a specific tag by ID.
Returns a 404 error if no tag exists with the specified ID.
"""
tag = await tag_store.read_tag(tag_id=tag_id)
return TagDTO(id=tag.id, creation_utc=tag.creatio... |
Retrieves details of a specific tag by ID.
Returns a 404 error if no tag exists with the specified ID.
| read_tag | python | emcie-co/parlant | src/parlant/api/tags.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/tags.py | Apache-2.0 |
async def list_tags() -> list[TagDTO]:
"""
Lists all tags in the system.
Returns an empty list if no tags exist.
Tags are returned in no particular order.
"""
tags = await tag_store.list_tags()
return [TagDTO(id=tag.id, creation_utc=tag.creation_utc, name=tag.na... |
Lists all tags in the system.
Returns an empty list if no tags exist.
Tags are returned in no particular order.
| list_tags | python | emcie-co/parlant | src/parlant/api/tags.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/tags.py | Apache-2.0 |
async def update_tag(
tag_id: TagIdPath,
params: TagUpdateParamsDTO,
) -> TagDTO:
"""
Updates an existing tag's name.
Only the name can be modified,
The tag's ID and creation timestamp cannot be modified.
"""
tag = await tag_store.update_tag(
... |
Updates an existing tag's name.
Only the name can be modified,
The tag's ID and creation timestamp cannot be modified.
| update_tag | python | emcie-co/parlant | src/parlant/api/tags.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/tags.py | Apache-2.0 |
async def delete_tag(
tag_id: TagId,
) -> None:
"""
Permanently deletes a tag.
This operation cannot be undone. Returns a 404 error if no tag exists with the specified ID.
Note that deleting a tag does not affect resources that were previously tagged with it.
"""
... |
Permanently deletes a tag.
This operation cannot be undone. Returns a 404 error if no tag exists with the specified ID.
Note that deleting a tag does not affect resources that were previously tagged with it.
| delete_tag | python | emcie-co/parlant | src/parlant/api/tags.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/tags.py | Apache-2.0 |
async def read_utterance(
utterance_id: UtteranceIdField,
) -> UtteranceDTO:
"""Retrieves details of a specific utterance by ID."""
utterance = await utterance_store.read_utterance(utterance_id=utterance_id)
return UtteranceDTO(
id=utterance.id,
creation_utc=... | Retrieves details of a specific utterance by ID. | read_utterance | python | emcie-co/parlant | src/parlant/api/utterances.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/utterances.py | Apache-2.0 |
async def update_utterance(
utterance_id: UtteranceIdField, params: UtteranceUpdateParamsDTO
) -> UtteranceDTO:
"""
Updates an existing utterance's attributes.
Only provided attributes will be updated; others remain unchanged.
The utterance's ID and creation timestamp cannot... |
Updates an existing utterance's attributes.
Only provided attributes will be updated; others remain unchanged.
The utterance's ID and creation timestamp cannot be modified.
Extra metadata and tags can be added or removed independently.
| update_utterance | python | emcie-co/parlant | src/parlant/api/utterances.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/api/utterances.py | Apache-2.0 |
def raise_for_status_with_detail(response: requests.Response) -> None:
"""Raises :class:`HTTPError`, if one occurred, with detail if exists
Adapted from requests.Response.raise_for_status"""
http_error_msg = ""
if isinstance(response.reason, bytes):
try:
reason = response.reason.de... | Raises :class:`HTTPError`, if one occurred, with detail if exists
Adapted from requests.Response.raise_for_status | raise_for_status_with_detail | python | emcie-co/parlant | src/parlant/bin/client.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/bin/client.py | Apache-2.0 |
async def get_component_versions() -> list[tuple[str, str]]:
"""Get current versions of all components"""
versions = []
def _get_version_from_json_file(
file_path: Path,
collection_name: str,
) -> Optional[str]:
if not file_path.exists():
return None
with op... | Get current versions of all components | get_component_versions | python | emcie-co/parlant | src/parlant/bin/prepare_migration.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/bin/prepare_migration.py | Apache-2.0 |
def cast_tool_argument(parameter_type: Any, argument: Any) -> Any:
"""This function converts the argument values to the type expected by the function.
First - "type wrappers" such as Optional and annotated are "translated" to the inner type.
Second - Collections (currently only lists) are split and run recu... | This function converts the argument values to the type expected by the function.
First - "type wrappers" such as Optional and annotated are "translated" to the inner type.
Second - Collections (currently only lists) are split and run recursively on the items.
Third - The argument is cast to the type of the ... | cast_tool_argument | python | emcie-co/parlant | src/parlant/core/tools.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/tools.py | Apache-2.0 |
async def utter(
self,
context: Context,
event_emitter: EventEmitter,
requests: Sequence[UtteranceRequest],
) -> bool:
"""Produces a new message into a session, guided by specific utterance requests"""
# Load the full relevant information from storage.
loaded... | Produces a new message into a session, guided by specific utterance requests | utter | python | emcie-co/parlant | src/parlant/core/engines/alpha/engine.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/engine.py | Apache-2.0 |
async def add_tool_event(
self,
tool_id: ToolId,
arguments: dict[str, JSONSerializable],
result: ToolResult,
) -> None:
"""Adds a staged tool event to the loaded context"""
self.state.tool_events.append(
EmittedEvent(
source=EventSource.SYS... | Adds a staged tool event to the loaded context | add_tool_event | python | emcie-co/parlant | src/parlant/core/engines/alpha/loaded_context.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/loaded_context.py | Apache-2.0 |
async def get_processing_indicator_delay(
self,
context: LoadedContext | None = None,
) -> float:
"""
Returns the delay before the indicator (agent is thinking...) is sent.
:param context: The loaded context containing session and interaction details.
:return: The de... |
Returns the delay before the indicator (agent is thinking...) is sent.
:param context: The loaded context containing session and interaction details.
:return: The delay in seconds before sending the indicator.
| get_processing_indicator_delay | python | emcie-co/parlant | src/parlant/core/engines/alpha/perceived_performance_policy.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/perceived_performance_policy.py | Apache-2.0 |
async def get_follow_up_delay(
self,
context: LoadedContext | None = None,
) -> float:
"""
Returns the delay before a follow-up message is sent.
:param context: The loaded context containing session and interaction details.
:return: The delay in seconds before sendin... |
Returns the delay before a follow-up message is sent.
:param context: The loaded context containing session and interaction details.
:return: The delay in seconds before sending the follow-up message.
| get_follow_up_delay | python | emcie-co/parlant | src/parlant/core/engines/alpha/perceived_performance_policy.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/perceived_performance_policy.py | Apache-2.0 |
async def get_preamble_delay(
self,
context: LoadedContext | None = None,
) -> float:
"""
Returns the delay before the preamble message is sent.
:param context: The loaded context containing session and interaction details.
:return: The delay in seconds before sendin... |
Returns the delay before the preamble message is sent.
:param context: The loaded context containing session and interaction details.
:return: The delay in seconds before sending the preamble message.
| get_preamble_delay | python | emcie-co/parlant | src/parlant/core/engines/alpha/perceived_performance_policy.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/perceived_performance_policy.py | Apache-2.0 |
async def is_preamble_required(
self,
context: LoadedContext | None = None,
) -> bool:
"""
Determines if a preamble message is required for the given context.
:param context: The loaded context containing session and interaction details.
:return: True if a preamble i... |
Determines if a preamble message is required for the given context.
:param context: The loaded context containing session and interaction details.
:return: True if a preamble is required, False otherwise.
| is_preamble_required | python | emcie-co/parlant | src/parlant/core/engines/alpha/perceived_performance_policy.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/perceived_performance_policy.py | Apache-2.0 |
async def _validate_argument_value(
self,
parameter: tuple[ToolParameterDescriptor, ToolParameterOptions],
value: str,
) -> bool:
"""Currently validate only parameters with enum values"""
descriptor = parameter[0]
if "enum" in descriptor:
if descriptor["ty... | Currently validate only parameters with enum values | _validate_argument_value | python | emcie-co/parlant | src/parlant/core/engines/alpha/tool_calling/single_tool_batch.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/tool_calling/single_tool_batch.py | Apache-2.0 |
def _format_type(descriptor_type: str) -> str:
"""Return the type-specific format suffix for the given descriptor type."""
if descriptor_type == "datetime":
return f"{descriptor_type}: year-month-day hour:minute:second"
if descriptor_type == "date":
re... | Return the type-specific format suffix for the given descriptor type. | _format_type | python | emcie-co/parlant | src/parlant/core/engines/alpha/tool_calling/single_tool_batch.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/engines/alpha/tool_calling/single_tool_batch.py | Apache-2.0 |
async def create_collection(
self,
name: str,
schema: type[TDocument],
) -> DocumentCollection[TDocument]:
"""
Creates a new collection with the given name and returns the collection.
"""
... |
Creates a new collection with the given name and returns the collection.
| create_collection | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def get_collection(
self,
name: str,
schema: type[TDocument],
document_loader: Callable[[BaseDocument], Awaitable[Optional[TDocument]]],
) -> DocumentCollection[TDocument]:
"""
Retrieves an existing collection by its name.
"""
... |
Retrieves an existing collection by its name.
| get_collection | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def get_or_create_collection(
self,
name: str,
schema: type[TDocument],
document_loader: Callable[[BaseDocument], Awaitable[Optional[TDocument]]],
) -> DocumentCollection[TDocument]:
"""
Retrieves an existing collection by its name or creates a new one if it doe... |
Retrieves an existing collection by its name or creates a new one if it does not exist.
| get_or_create_collection | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def find(
self,
filters: Where,
) -> Sequence[TDocument]:
"""Finds all documents that match the given filters."""
... | Finds all documents that match the given filters. | find | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def find_one(
self,
filters: Where,
) -> Optional[TDocument]:
"""Returns the first document that matches the query criteria."""
... | Returns the first document that matches the query criteria. | find_one | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def insert_one(
self,
document: TDocument,
) -> InsertResult:
"""Inserts a single document into the collection."""
... | Inserts a single document into the collection. | insert_one | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def update_one(
self,
filters: Where,
params: TDocument,
upsert: bool = False,
) -> UpdateResult[TDocument]:
"""Updates the first document that matches the query criteria. If upsert is True,
inserts the document if it does not exist."""
... | Updates the first document that matches the query criteria. If upsert is True,
inserts the document if it does not exist. | update_one | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def delete_one(
self,
filters: Where,
) -> DeleteResult[TDocument]:
"""Deletes the first document that matches the query criteria."""
... | Deletes the first document that matches the query criteria. | delete_one | python | emcie-co/parlant | src/parlant/core/persistence/document_database.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/persistence/document_database.py | Apache-2.0 |
async def shutdown(self) -> None:
"""At the time of creating this server, there is no graceful shutdown for the FactMCP http server"""
if self.started() and hasattr(self._server, "server") and self._server.server:
self._server.server.should_exit = True | At the time of creating this server, there is no graceful shutdown for the FactMCP http server | shutdown | python | emcie-co/parlant | src/parlant/core/services/tools/mcp_service.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/services/tools/mcp_service.py | Apache-2.0 |
async def _recompute_and_marshal_tool(
tool: Tool, plugin_data: Mapping[str, Any], context: ToolContext
) -> Tool:
"""This function is specifically used to refresh some of the tool's
details based on dynamic changes (e.g., updating parameter descriptors
based on dynamically-generated enum choices)"""
... | This function is specifically used to refresh some of the tool's
details based on dynamic changes (e.g., updating parameter descriptors
based on dynamically-generated enum choices) | _recompute_and_marshal_tool | python | emcie-co/parlant | src/parlant/core/services/tools/plugins.py | https://github.com/emcie-co/parlant/blob/master/src/parlant/core/services/tools/plugins.py | Apache-2.0 |
async def get_electronic_products_by_type(
product_type: ElectronicProductType,
) -> ToolResult:
"""Get all products that match the specified product type"""
with open("tests/data/get_products_by_type_data.json", "r") as f:
database = json.load(f)
products = [item for item in database if item["t... | Get all products that match the specified product type | get_electronic_products_by_type | python | emcie-co/parlant | tests/tool_utilities.py | https://github.com/emcie-co/parlant/blob/master/tests/tool_utilities.py | Apache-2.0 |
def _wait_for_port_ready(
server_address: str,
max_attempts: int = 40,
initial_delay: float = 0.1,
) -> None:
"""Wait for the server port to be ready to accept connections."""
# Parse the server address to get host and port
host, port_str = server_address.rsplit(":", 1)
if "://" in host:
... | Wait for the server port to be ready to accept connections. | _wait_for_port_ready | python | emcie-co/parlant | tests/e2e/test_utilities.py | https://github.com/emcie-co/parlant/blob/master/tests/e2e/test_utilities.py | Apache-2.0 |
async def consult_expert(context: ToolContext, user_query: str) -> ToolResult:
"""
This is an example for using the utterances feature
"""
async with httpx.AsyncClient(follow_redirects=True, timeout=30) as client:
(
await client.post(
f"http://localhost:8800/sessions... |
This is an example for using the utterances feature
| consult_expert | python | emcie-co/parlant | tests/modules/tech_store.py | https://github.com/emcie-co/parlant/blob/master/tests/modules/tech_store.py | Apache-2.0 |
def preferencesChanged(self, param, changes):
"""
Triggered when the preferences for this window are changed.
"""
# Use the default light theme/palette
if self.preferences["Light/Dark Theme"] == "Light":
QApplication.instance().setStyleSheet("")
QApplicat... |
Triggered when the preferences for this window are changed.
| preferencesChanged | python | CadQuery/CQ-editor | cq_editor/main_window.py | https://github.com/CadQuery/CQ-editor/blob/master/cq_editor/main_window.py | Apache-2.0 |
def update_window_title(self, modified):
"""
Allows updating the window title to show that the document has been modified.
"""
title = self.windowTitle().rstrip("*")
if modified:
title += "*"
self.setWindowTitle(title) |
Allows updating the window title to show that the document has been modified.
| update_window_title | python | CadQuery/CQ-editor | cq_editor/main_window.py | https://github.com/CadQuery/CQ-editor/blob/master/cq_editor/main_window.py | Apache-2.0 |
def app_theme_changed(self, theme):
"""
Allows this console to be changed to match the light or dark theme of the rest of the app.
"""
if theme == "Dark":
self.set_default_style("linux")
else:
self.set_default_style("lightbg") |
Allows this console to be changed to match the light or dark theme of the rest of the app.
| app_theme_changed | python | CadQuery/CQ-editor | cq_editor/widgets/console.py | https://github.com/CadQuery/CQ-editor/blob/master/cq_editor/widgets/console.py | Apache-2.0 |
def module_manager():
"""unloads any modules loaded while the context manager is active"""
loaded_modules = set(sys.modules.keys())
try:
yield
finally:
new_modules = set(sys.modules.keys()) - loaded_modules
for module_name in new_modules:
del sys.modules[module_name] | unloads any modules loaded while the context manager is active | module_manager | python | CadQuery/CQ-editor | cq_editor/widgets/debugger.py | https://github.com/CadQuery/CQ-editor/blob/master/cq_editor/widgets/debugger.py | Apache-2.0 |
def save(self):
"""
Saves the current document to the current filename if it exists, otherwise it triggers a
save-as dialog.
"""
if self._filename != "":
with open(self._filename, "w", encoding="utf-8") as f:
f.write(self.toPlainText())
#... |
Saves the current document to the current filename if it exists, otherwise it triggers a
save-as dialog.
| save | python | CadQuery/CQ-editor | cq_editor/widgets/editor.py | https://github.com/CadQuery/CQ-editor/blob/master/cq_editor/widgets/editor.py | Apache-2.0 |
def truncate_text(self, text, max_length=100):
"""
Used to prevent the label from expanding the window width off the screen.
"""
metrics = QFontMetrics(self.current_exception.font())
elided_text = metrics.elidedText(
text, Qt.ElideRight, self.current_exception.width()... |
Used to prevent the label from expanding the window width off the screen.
| truncate_text | python | CadQuery/CQ-editor | cq_editor/widgets/traceback_viewer.py | https://github.com/CadQuery/CQ-editor/blob/master/cq_editor/widgets/traceback_viewer.py | Apache-2.0 |
def test_log_clear(main):
"""
Makes sure that the log can be cleared.
"""
qtbot, win = main
log = win.components["log"]
log.clear_log()
assert log.toPlainText() == "" |
Makes sure that the log can be cleared.
| test_log_clear | python | CadQuery/CQ-editor | tests/test_app.py | https://github.com/CadQuery/CQ-editor/blob/master/tests/test_app.py | Apache-2.0 |
def test_light_dark_mode(main):
"""
Tests that the app does switch between light and dark mode.
"""
from PyQt5.QtGui import QPalette
qtbot, win = main
# Change to dark mode
win.preferences["Light/Dark Theme"] = "Dark"
win.preferencesChanged(None, None)
# Retireve the toolbar so th... |
Tests that the app does switch between light and dark mode.
| test_light_dark_mode | python | CadQuery/CQ-editor | tests/test_app.py | https://github.com/CadQuery/CQ-editor/blob/master/tests/test_app.py | Apache-2.0 |
def __call__(self, dev_id=None, **kwargs):
"""Note that we can specify any subset of arguments we care about... in this case, just dev_id."""
if dev_id not in self.seen_at_times:
self.seen_at_times[dev_id] = [time.time()]
else:
self.seen_at_times[dev_id].append(time.time(... | Note that we can specify any subset of arguments we care about... in this case, just dev_id. | __call__ | python | calebmadrigal/trackerjacker | plugin_examples/plugin_example1.py | https://github.com/calebmadrigal/trackerjacker/blob/master/plugin_examples/plugin_example1.py | MIT |
def trigger(dev_id=None, num_bytes=None, power=None, **kwargs):
"""Note that we can specify any subset of kwargs we are interested in."""
if num_bytes:
msg = 'Threshold reached for {} - {} bytes'.format(dev_id, num_bytes)
else:
msg = 'Saw {} at power level {}'.format(dev_id, power)
prin... | Note that we can specify any subset of kwargs we are interested in. | trigger | python | calebmadrigal/trackerjacker | plugin_examples/plugin_example2.py | https://github.com/calebmadrigal/trackerjacker/blob/master/plugin_examples/plugin_example2.py | MIT |
def test_2_macs_explicit(self):
""" Test 2 devices with explicitly setting threshold and power. """
test3 = 'aa:bb:cc:dd:ee:ff=1000, 11:22:33:44:55:66=-32'
parsed = cm.parse_command_line_watch_list(test3)
self.assertEqual(parsed, {'aa:bb:cc:dd:ee:ff': {'threshold': 1000, 'power': None},
... | Test 2 devices with explicitly setting threshold and power. | test_2_macs_explicit | python | calebmadrigal/trackerjacker | tests/test_config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/tests/test_config_management.py | MIT |
def test_config_macs_to_watch_general_threshold(self):
""" Test that general threshold is used if no explicit specified. """
cmd_line_args = cm.get_arg_parser().parse_args(['--track', '-m', '7C:70:BC:78:70:21,aa:bb:cc:dd:ee:ff',
'--threshold', '133... | Test that general threshold is used if no explicit specified. | test_config_macs_to_watch_general_threshold | python | calebmadrigal/trackerjacker | tests/test_config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/tests/test_config_management.py | MIT |
def test_config_macs_to_watch_mixed_override(self):
""" Test that we can have explicitly-set threshold and still get general power. """
cmd_line_args = cm.get_arg_parser().parse_args(['--track', '-m', '7C:70:BC:78:70:21=123,aa:bb:cc:dd:ee:ff',
'--p... | Test that we can have explicitly-set threshold and still get general power. | test_config_macs_to_watch_mixed_override | python | calebmadrigal/trackerjacker | tests/test_config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/tests/test_config_management.py | MIT |
def test_config_macs_to_watch_mixed_override_reverse(self):
""" Test that we can have explicitly-set power and still get general threshold. """
cmd_line_args = cm.get_arg_parser().parse_args(['--track', '-m', '7C:70:BC:78:70:21=-22,11:bb:cc:dd:ee:ff',
... | Test that we can have explicitly-set power and still get general threshold. | test_config_macs_to_watch_mixed_override_reverse | python | calebmadrigal/trackerjacker | tests/test_config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/tests/test_config_management.py | MIT |
def test_config_aps_to_watch(self):
""" Test setting explicit threshold and power, and test ssid. """
cmd_line_args = cm.get_arg_parser().parse_args(['--track', '-a', '7C:70:BC:78:70:21=100,my_network'])
config = cm.build_config(cmd_line_args)
self.assertEqual(config['aps_to_watch'], {'7... | Test setting explicit threshold and power, and test ssid. | test_config_aps_to_watch | python | calebmadrigal/trackerjacker | tests/test_config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/tests/test_config_management.py | MIT |
def parse_command_line_watch_list(watch_str):
"""Parse string that represents devices to watch.
Valid examples:
* aa:bb:cc:dd:ee:ff
- Threshold of 1 for the given MAC address
* aa:bb:cc:dd:ee:ff,11:22:33:44:55:66
- This means look for any traffic from either address
... | Parse string that represents devices to watch.
Valid examples:
* aa:bb:cc:dd:ee:ff
- Threshold of 1 for the given MAC address
* aa:bb:cc:dd:ee:ff,11:22:33:44:55:66
- This means look for any traffic from either address
* aa:bb:cc:dd:ee:ff=1337, 11:22:33:44:55:66=1000
... | parse_command_line_watch_list | python | calebmadrigal/trackerjacker | trackerjacker/config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/config_management.py | MIT |
def determine_watch_list(to_watch_from_args,
to_watch_from_config,
generic_threshold,
generic_power):
"""Builds the list of devices to watch.
Coalesces the to_watch list from the command-line arguments, the config file,
and the the ... | Builds the list of devices to watch.
Coalesces the to_watch list from the command-line arguments, the config file,
and the the general threshold, power, and trigger command. The main idea here is to look
for the config values set on a per-device basis, and prioritize those, but if they are not there,
f... | determine_watch_list | python | calebmadrigal/trackerjacker | trackerjacker/config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/config_management.py | MIT |
def build_config(args):
"""Builds the config from the command-line args, config file, and defaults."""
config = copy.deepcopy(DEFAULT_CONFIG)
devices_from_config = {}
aps_from_config = {}
if args.config:
try:
with open(args.config, 'r') as f:
config_from_file = j... | Builds the config from the command-line args, config file, and defaults. | build_config | python | calebmadrigal/trackerjacker | trackerjacker/config_management.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/config_management.py | MIT |
def frame_type_name(self):
"""Returns the type of frame - 'management', 'control', 'data', or 'unknown'."""
if self.frame.type == self.DOT11_FRAME_TYPE_MANAGEMENT:
return 'management'
elif self.frame.type == self.DOT11_FRAME_TYPE_CONTROL:
return 'control'
elif sel... | Returns the type of frame - 'management', 'control', 'data', or 'unknown'. | frame_type_name | python | calebmadrigal/trackerjacker | trackerjacker/dot11_frame.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/dot11_frame.py | MIT |
def get_dev_node(self, mac):
"""Returns ap_node associated with mac in a thread-safe manner."""
device_node = None
with self.lock:
if mac in self.devices:
device_node = copy.deepcopy(self.devices[mac])
return device_node | Returns ap_node associated with mac in a thread-safe manner. | get_dev_node | python | calebmadrigal/trackerjacker | trackerjacker/dot11_mapper.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/dot11_mapper.py | MIT |
def save_to_file(self, file_path):
"""Serializes to file_path in a YAML format something like this:
example_ssid_name:
80:29:94:14:8a:1d:
channels:
- 6
- 11
signal: -86
vendor: Google, Inc.
... | Serializes to file_path in a YAML format something like this:
example_ssid_name:
80:29:94:14:8a:1d:
channels:
- 6
- 11
signal: -86
vendor: Google, Inc.
devices:
f4:f5:d8:2b:9f... | save_to_file | python | calebmadrigal/trackerjacker | trackerjacker/dot11_mapper.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/dot11_mapper.py | MIT |
def _with_frames_summed(dev_node):
"""Helper function to aid in serialization."""
dev_node = copy.deepcopy(dev_node)
frames_in = sum([num_bytes for _, num_bytes in dev_node.pop('frames_in', ())])
frames_out = sum([num_bytes for _, num_bytes in dev_node.pop('frames_out', ())])
dev... | Helper function to aid in serialization. | _with_frames_summed | python | calebmadrigal/trackerjacker | trackerjacker/dot11_mapper.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/dot11_mapper.py | MIT |
def load_from_file(file_path, remove_unseen_devices=False):
"""Factory function to load a Dot11Map from file_path provided."""
with open(file_path, 'r') as f:
yaml_data = f.read()
yaml = ruamel.yaml.YAML(typ='safe')
map_data = yaml.load(yaml_data)
# If file is empty... | Factory function to load a Dot11Map from file_path provided. | load_from_file | python | calebmadrigal/trackerjacker | trackerjacker/dot11_mapper.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/dot11_mapper.py | MIT |
def do_trigger_alert(self,
dev_id,
dev_type,
num_bytes=None,
data_threshold=None,
power_threshold=None,
vendor=None,
frame=None,
... | Do alert for triggered item.
Args:
alert_msg: Message to log for the alert
| do_trigger_alert | python | calebmadrigal/trackerjacker | trackerjacker/dot11_tracker.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/dot11_tracker.py | MIT |
def get_bytes_in_window(self, frame_list):
"""Returns number of bytes in a frame_list.
Args:
frame_list: List in format - [(ts1, num_bytes1), (ts2, num_bytes2)]
"""
bytes_in_window = 0
now = time.time()
for ts, num_bytes in frame_list:
if (now - t... | Returns number of bytes in a frame_list.
Args:
frame_list: List in format - [(ts1, num_bytes1), (ts2, num_bytes2)]
| get_bytes_in_window | python | calebmadrigal/trackerjacker | trackerjacker/dot11_tracker.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/dot11_tracker.py | MIT |
def lookup(self, mac):
"""MAC -> Manufacturer ('48:AD:08:AA:BB:CC' -> 'HUAWEI TECHNOLOGIES CO.,LTD')"""
try:
oui_prefix = mac.upper().replace(':', '')[0:6]
if oui_prefix in self.db:
return self.db[oui_prefix]
except Exception:
pass
ret... | MAC -> Manufacturer ('48:AD:08:AA:BB:CC' -> 'HUAWEI TECHNOLOGIES CO.,LTD') | lookup | python | calebmadrigal/trackerjacker | trackerjacker/ieee_mac_vendor_db.py | https://github.com/calebmadrigal/trackerjacker/blob/master/trackerjacker/ieee_mac_vendor_db.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.