Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge Release 0.16 #236

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/validate-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install/install.sh
DAPR_CLI_REF: ${{ github.event.inputs_daprcli_commit }}
DAPR_CLI_VERSION: ${{ github.event.inputs_daprcli_version }}
DAPR_REF: ${{ github.event.inputs.dapr_commit }}
DAPR_REF: 334ae9eea43d487a7b29a0e4aef904e3eba57a10
DAPR_RUNTIME_VERSION: ${{ github.event.inputs.dapr_version }}
CHECKOUT_REPO: ${{ github.repository }}
CHECKOUT_REF: ${{ github.ref }}
Expand Down Expand Up @@ -76,14 +76,14 @@ jobs:
- name: Determine latest Dapr Runtime version
if: env.DAPR_RUNTIME_VERSION == ''
run: |
RUNTIME_VERSION=$(curl -s "https://api.github.com/repos/dapr/dapr/releases/latest" | grep '"tag_name"' | cut -d ':' -f2 | tr -d '",v')
RUNTIME_VERSION=$(curl -s "https://api.github.com/repos/dapr/dapr/releases/latest" | grep '"tag_name"' | cut -d ':' -f2 | tr -d ' ",v')
echo "DAPR_RUNTIME_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
echo "Found $RUNTIME_VERSION"

- name: Determine latest Dapr Cli version
if: env.DAPR_CLI_VERSION == ''
run: |
CLI_VERSION=$(curl -s "https://api.github.com/repos/dapr/cli/releases/latest" | grep '"tag_name"' | cut -d ':' -f2 | tr -d '",v')
CLI_VERSION=$(curl -s "https://api.github.com/repos/dapr/cli/releases/latest" | grep '"tag_name"' | cut -d ':' -f2 | tr -d ' ",v')
echo "DAPR_CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
echo "Found $CLI_VERSION"

Expand Down Expand Up @@ -127,6 +127,7 @@ jobs:
cd dapr_runtime
make
echo "artifactPath=~/artifacts/$GITHUB_SHA/" >> $GITHUB_ENV
mkdir -p $HOME/artifacts/$GITHUB_SHA/
RUNTIME_VERSION=edge
echo "DAPR_RUNTIME_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV

Expand All @@ -135,7 +136,7 @@ jobs:
run: |
mkdir ~/dapr_docker
cd dapr_runtime
docker build --build-arg "PKG_FILES=*" -f ./docker/Dockerfile ./dist/linux_amd64/release -t daprio/dapr:0.0.0-dev
docker build --build-arg "PKG_FILES=*" -f ./docker/Dockerfile ./dist/linux_amd64/release -t daprio/dapr:9.0.0-dev

- name: Download Install Bundle CLI
if: env.DAPR_REF != '' && env.DAPR_CLI_REF == ''
Expand All @@ -147,14 +148,14 @@ jobs:
ls -la

- name: Build Custom Install Bundle
if: env.DAPR_REF != '' && env.DAPR_CLI_REF != ''
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
run: |
: # Create daprbundle directory
mkdir ~/daprbundle
cp .github/workflows/validate-examples/details.json ~/daprbundle/

: # Add cli
cp ~/artifacts/$GITHUB_SHA/dapr ~/daprbundle/dapr
cp cli/dist/linux_amd64/release/dapr ~/daprbundle/dapr

: # Compress executables to /dist/ appending _linux_amd64 to the name
mkdir ~/daprbundle/dist
Expand All @@ -169,7 +170,7 @@ jobs:

: # Add docker image
mkdir ~/daprbundle/docker
docker save daprio/dapr:0.0.0-dev | gzip > ~/daprbundle/docker/daprio-dapr-0.0.0-dev.tar.gz
docker save daprio/dapr:9.0.0-dev | gzip > ~/daprbundle/docker/daprio-dapr-9.0.0-dev.tar.gz

: # Bundle
cd ~/daprbundle
Expand Down Expand Up @@ -219,7 +220,7 @@ jobs:
fail-fast: false
matrix:
examples:
[ "actors", "bindings", "client", "configuration", "crypto", "invoke/grpc", "invoke/grpc-proxying", "jobs", "pubsub", "query_state", "secrets-bulk" ]
[ "actors", "bindings", "client", "configuration", "conversation", "crypto", "invoke/grpc", "invoke/grpc-proxying", "jobs", "pubsub", "query_state", "secrets-bulk" ]
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/validate-examples/details.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"daprd": "0.0.0-dev",
"dashboard": "0.0.0-dev",
"cli": "0.0.0-dev",
"daprd": "9.0.0-dev",
"dashboard": "9.0.0-dev",
"cli": "9.0.0-dev",
"daprBinarySubDir": "dist",
"dockerImageSubDir": "docker",
"daprImageName": "daprio/dapr:0.0.0-dev",
"daprImageFileName": "daprio-dapr-0.0.0-dev.tar.gz"
"daprImageName": "daprio/dapr:9.0.0-dev",
"daprImageFileName": "daprio-dapr-9.0.0-dev.tar.gz"
}
98 changes: 98 additions & 0 deletions dapr/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,18 @@ impl<T: DaprInterface> Client<T> {
};
self.0.delete_job_alpha1(request).await
}

/// Converse with an LLM
///
/// # Arguments
///
/// * ConversationRequest - The request containing inputs to send to the LLM
pub async fn converse_alpha1(
&mut self,
request: ConversationRequest,
) -> Result<ConversationResponse, Error> {
self.0.converse_alpha1(request).await
}
}

#[async_trait]
Expand Down Expand Up @@ -595,6 +607,11 @@ pub trait DaprInterface: Sized {
&mut self,
request: DeleteJobRequest,
) -> Result<DeleteJobResponse, Error>;

async fn converse_alpha1(
&mut self,
request: ConversationRequest,
) -> Result<ConversationResponse, Error>;
}

#[async_trait]
Expand Down Expand Up @@ -789,6 +806,16 @@ impl DaprInterface for dapr_v1::dapr_client::DaprClient<TonicChannel> {
.await?
.into_inner())
}

async fn converse_alpha1(
&mut self,
request: ConversationRequest,
) -> Result<ConversationResponse, Error> {
Ok(self
.converse_alpha1(Request::new(request))
.await?
.into_inner())
}
}

/// A request from invoking a service
Expand Down Expand Up @@ -907,6 +934,18 @@ pub type DeleteJobRequest = crate::dapr::proto::runtime::v1::DeleteJobRequest;
/// A response from a delete job request
pub type DeleteJobResponse = crate::dapr::proto::runtime::v1::DeleteJobResponse;

/// A request to conversate with an LLM
pub type ConversationRequest = crate::dapr::proto::runtime::v1::ConversationRequest;

/// A response from conversating with an LLM
pub type ConversationResponse = crate::dapr::proto::runtime::v1::ConversationResponse;

/// A result from an interacting with a LLM
pub type ConversationResult = crate::dapr::proto::runtime::v1::ConversationResult;

/// An input to the conversation
pub type ConversationInput = crate::dapr::proto::runtime::v1::ConversationInput;

type StreamPayload = crate::dapr::proto::common::v1::StreamPayload;
impl<K> From<(K, Vec<u8>)> for common_v1::StateItem
where
Expand Down Expand Up @@ -987,3 +1026,62 @@ impl JobBuilder {
}
}
}

pub struct ConversationInputBuilder {
message: String,
role: Option<String>,
scrub_pii: Option<bool>,
}

impl ConversationInputBuilder {
pub fn new(message: &str) -> Self {
ConversationInputBuilder {
message: message.to_string(),
role: None,
scrub_pii: None,
}
}

pub fn build(self) -> ConversationInput {
ConversationInput {
message: self.message,
role: self.role,
scrub_pii: self.scrub_pii,
}
}
}

pub struct ConversationRequestBuilder {
name: String,
context_id: Option<String>,
inputs: Vec<ConversationInput>,
parameters: HashMap<String, Any>,
metadata: HashMap<String, String>,
scrub_pii: Option<bool>,
temperature: Option<f64>,
}
impl ConversationRequestBuilder {
pub fn new(name: &str, inputs: Vec<ConversationInput>) -> Self {
ConversationRequestBuilder {
name: name.to_string(),
context_id: None,
inputs,
parameters: Default::default(),
metadata: Default::default(),
scrub_pii: None,
temperature: None,
}
}

pub fn build(self) -> ConversationRequest {
ConversationRequest {
name: self.name,
context_id: self.context_id,
inputs: self.inputs,
parameters: self.parameters,
metadata: self.metadata,
scrub_pii: self.scrub_pii,
temperature: self.temperature,
}
}
}
Loading
Loading