Skip to content

Commit

Permalink
Merge pull request #50 from CommandDash/rel-0.3.4
Browse files Browse the repository at this point in the history
Rel 0.3.4
  • Loading branch information
samyakkkk authored May 1, 2024
2 parents c472e1a + 1407f9c commit f3f06ea
Show file tree
Hide file tree
Showing 49 changed files with 979 additions and 335 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/publish_agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Publish Dash Agent Package

on:
push:
tags:
- 'agent-v[0-9]+.[0-9]+.[0-9]+*'

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
working-directory: dash_agent
14 changes: 14 additions & 0 deletions .github/workflows/publish_cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Publish Dash CLI Package

on:
push:
tags:
- 'cli-v[0-9]+.[0-9]+.[0-9]+*'

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
working-directory: dash_cli
41 changes: 22 additions & 19 deletions commanddash/lib/agent/agent_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ class AgentHandler {
final String agentName;
final String agentVersion;

AgentHandler({
required this.inputs,
required this.outputs,
required this.steps,
required this.generationRepository,
required this.agentName,
required this.agentVersion,
this.githubAccessToken,
});
/// Marks the agent as a test agent.
final bool isTest;

AgentHandler(
{required this.inputs,
required this.outputs,
required this.steps,
required this.generationRepository,
required this.agentName,
required this.agentVersion,
this.githubAccessToken,
this.isTest = false});

factory AgentHandler.fromJson(Map<String, dynamic> json) {
final inputs = <String, Input>{};
Expand All @@ -40,14 +43,14 @@ class AgentHandler {
GenerationRepository.fromJson(json['auth_details']);

return AgentHandler(
inputs: inputs,
outputs: outputs,
steps: steps,
generationRepository: generationRepository,
githubAccessToken: json['auth_details']['github_token'],
agentName: json['agent_name'],
agentVersion: json['agent_version'],
);
inputs: inputs,
outputs: outputs,
steps: steps,
generationRepository: generationRepository,
githubAccessToken: json['auth_details']['github_token'],
agentName: json['agent_name'],
agentVersion: json['agent_version'],
isTest: json['testing']);
}

Future<void> runTask(TaskAssist taskAssist) async {
Expand All @@ -58,8 +61,8 @@ class AgentHandler {
try {
for (Map<String, dynamic> stepJson in steps) {
try {
final step =
Step.fromJson(stepJson, inputs, outputs, agentName, agentVersion);
final step = Step.fromJson(
stepJson, inputs, outputs, agentName, agentVersion, isTest);
final results = await step.run(
taskAssist, generationRepository, dashRepository) ??
[];
Expand Down
19 changes: 12 additions & 7 deletions commanddash/lib/agent/step_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ abstract class Step {
// required this.outputs,
});

factory Step.fromJson(Map<String, dynamic> json, Map<String, Input> inputs,
Map<String, Output> outputs, String agentName, String agentVersion) {
factory Step.fromJson(
Map<String, dynamic> json,
Map<String, Input> inputs,
Map<String, Output> outputs,
String agentName,
String agentVersion,
bool isTest) {
switch (json['type']) {
case 'search_in_workspace':
return SearchInWorkspaceStep.fromJson(
Expand Down Expand Up @@ -73,11 +78,11 @@ abstract class Step {
);
case 'search_in_sources':
return SearchInSourceStep.fromJson(
json,
(json['query'] as String).replacePlaceholder(inputs, outputs),
agentName,
agentVersion,
);
json,
(json['query'] as String).replacePlaceholder(inputs, outputs),
agentName,
agentVersion,
isTest);
default:
throw Exception('Unknown step type: ${json['type']}');
}
Expand Down
14 changes: 7 additions & 7 deletions commanddash/lib/repositories/dash_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class DashRepository {
return response.data;
}

Future<List<DataSource>> getDatasource({
required String agentName,
required String agentVersion,
required String query,
required List<DataSource> datasources,
}) async {
Future<List<DataSource>> getDatasource(
{required String agentName,
required String agentVersion,
required String query,
required List<DataSource> datasources,
required bool isTest}) async {
try {
final response = await dio.post(
'/agent/get-reference',
Expand All @@ -37,7 +37,7 @@ class DashRepository {
"query": query,
"version": agentVersion,
"matching_doc_data_source_ids": datasources.map((e) => e.id).toList(),
"testing": false,
"testing": isTest,
},
);
return List<Map<String, dynamic>>.from(response.data['data']).map((e) {
Expand Down
2 changes: 1 addition & 1 deletion commanddash/lib/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class VersionCommand extends Command {
@override
void run() {
/// It is not possible to fetch version from pubspec.yaml hence assigning manually
print('0.0.3');
print('0.0.4');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ class SearchInSourceStep extends Step {
final List<DataSource> dataSource;
final String agentName;
final String agentVersion;
final bool isTest;

SearchInSourceStep({
required List<String> outputIds,
required this.query,
required this.dataSource,
required this.agentName,
required this.agentVersion,
required this.isTest,
Loader loader = const MessageLoader('Searching in sources'),
}) : super(
outputIds: outputIds,
Expand All @@ -33,16 +35,19 @@ class SearchInSourceStep extends Step {
String query,
String agentName,
String agentVersion,
bool isTest,
) {
return SearchInSourceStep(
outputIds:
(json['outputs'] as List<dynamic>).map((e) => e.toString()).toList(),
query: query,
agentName: agentName,
agentVersion: agentVersion,
dataSource:
(json['data_sources'] as List).map((e) => DataSource(id: e)).toList(),
);
outputIds: (json['outputs'] as List<dynamic>)
.map((e) => e.toString())
.toList(),
query: query,
agentName: agentName,
agentVersion: agentVersion,
dataSource: (json['data_sources'] as List)
.map((e) => DataSource(id: e))
.toList(),
isTest: isTest);
}

@override
Expand All @@ -57,7 +62,8 @@ class SearchInSourceStep extends Step {
query: query,
agentName: agentName,
agentVersion: agentVersion,
datasources: dataSource);
datasources: dataSource,
isTest: isTest);
return [DataSourceResultOutput(response)];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SearchInWorkspaceStep extends Step {
"embeddings":
json.encode(embeddedFiles.map((e) => e.getCacheMap()).toList()),
},
timeoutKind: TimeoutKind.stretched);
timeoutKind: TimeoutKind.sync);

// This logic is include the newly generated embeddings in the embedding matching
for (var file in dartFiles) {
Expand Down
2 changes: 1 addition & 1 deletion commanddash/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: commanddash
description: CLI enhancments to Dash-AI
version: 0.0.3
version: 0.0.4
repository: https://github.com/Welltested-AI/commanddash

environment:
Expand Down
13 changes: 12 additions & 1 deletion dash_agent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 0.1.1

* Fixed type cast error for `PromptQueryStep.dashOutputs`
* README update

## 0.1.0

* `SystemDataObject` dropped for `FileDataObject`
* README update
* End token implementation to convey dash_cli the end of json

## 0.0.1

* TODO: Describe initial release.
* Initial Release
Loading

0 comments on commit f3f06ea

Please sign in to comment.